9#ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H
10#define LLVM_CLANG_DRIVER_TOOLCHAIN_H
18#include "llvm/ADT/APFloat.h"
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/FloatingPointMode.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/Frontend/Debug/Options.h"
24#include "llvm/MC/MCTargetOptions.h"
25#include "llvm/Option/Option.h"
26#include "llvm/Support/VersionTuple.h"
27#include "llvm/Target/TargetOptions.h"
28#include "llvm/TargetParser/Triple.h"
142 const llvm::opt::ArgList &Args;
145 const llvm::opt::Arg *
const CachedRTTIArg;
160 mutable std::unique_ptr<Tool> Clang;
161 mutable std::unique_ptr<Tool> Flang;
162 mutable std::unique_ptr<Tool> Assemble;
163 mutable std::unique_ptr<Tool> Link;
164 mutable std::unique_ptr<Tool> StaticLibTool;
165 mutable std::unique_ptr<Tool> IfsMerge;
167 mutable std::unique_ptr<Tool> OffloadPackager;
168 mutable std::unique_ptr<Tool> LinkerWrapper;
170 Tool *getClang()
const;
171 Tool *getFlang()
const;
172 Tool *getAssemble()
const;
173 Tool *getLink()
const;
174 Tool *getStaticLibTool()
const;
175 Tool *getIfsMerge()
const;
176 Tool *getClangAs()
const;
177 Tool *getOffloadBundler()
const;
178 Tool *getOffloadPackager()
const;
179 Tool *getLinkerWrapper()
const;
181 mutable bool SanitizerArgsChecked =
false;
184 mutable llvm::Triple EffectiveTriple;
187 void setEffectiveTriple(llvm::Triple ET)
const {
188 EffectiveTriple = std::move(ET);
191 std::optional<std::string>
192 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
194 mutable std::optional<CXXStdlibType> cxxStdlibType;
195 mutable std::optional<RuntimeLibType> runtimeLibType;
196 mutable std::optional<UnwindLibType> unwindLibType;
203 const llvm::opt::ArgList &Args);
215 bool IsFortran =
false)
const;
225 llvm::opt::ArgStringList &CC1Args,
228 llvm::opt::ArgStringList &CC1Args,
232 llvm::opt::ArgStringList &CC1Args,
235 llvm::opt::ArgStringList &CC1Args,
238 llvm::opt::ArgStringList &CC1Args,
241 static std::string
concat(StringRef
Path,
const Twine &A,
const Twine &B =
"",
242 const Twine &
C =
"",
const Twine &
D =
"");
247 llvm::opt::ArgStringList &CC1Args,
254 llvm::vfs::FileSystem &
getVFS()
const;
255 const llvm::Triple &
getTriple()
const {
return Triple; }
269 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
272 StringRef
getOS()
const {
return Triple.getOSName(); }
279 return Triple.getTriple();
284 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
285 return EffectiveTriple;
289 return !EffectiveTriple.getTriple().empty();
324 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
358 virtual llvm::opt::DerivedArgList *
368 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
375 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
376 llvm::opt::DerivedArgList *DAL,
382 virtual llvm::opt::DerivedArgList *
404 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
511 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
514 bool IsFortran =
false)
const;
518 llvm::opt::ArgStringList &CmdArgs)
const;
523 llvm::opt::ArgStringList &CmdArgs)
const;
527 llvm::opt::ArgStringList &CmdArgs)
const;
532 bool IsFortran =
false)
const;
593 return llvm::codegenoptions::DIF_DWARF;
620 return llvm::DebuggerKind::GDB;
631 const llvm::opt::ArgList &Args)
const {}
634 virtual llvm::ExceptionHandling
650 const llvm::Triple &TargetTriple,
651 StringRef SysRoot)
const {
652 return TargetTriple.str();
667 const llvm::opt::ArgList &Args,
693 llvm::opt::ArgStringList &CC1Args)
const;
697 llvm::opt::ArgStringList &CC1Args,
703 llvm::opt::ArgStringList &CC1ASArgs)
const;
735 llvm::opt::ArgStringList &CC1Args)
const;
740 llvm::opt::ArgStringList &CC1Args)
const;
749 llvm::opt::ArgStringList &CmdArgs)
const;
753 llvm::opt::ArgStringList &CmdArgs)
const;
758 llvm::opt::ArgStringList &CmdArgs)
const;
765 const llvm::opt::ArgList &Args, std::string &
Path)
const;
772 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
781 llvm::opt::ArgStringList &CmdArgs)
const;
785 llvm::opt::ArgStringList &CC1Args)
const;
789 llvm::opt::ArgStringList &CC1Args)
const;
793 llvm::opt::ArgStringList &CC1Args)
const;
797 llvm::opt::ArgStringList &CC1Args)
const;
801 const llvm::opt::ArgList &Args)
const;
811 llvm::opt::ArgStringList &CmdArgs)
const {}
829 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
830 const llvm::fltSemantics *FPType =
nullptr)
const {
831 return llvm::DenormalMode::getIEEE();
837 llvm::Triple TT(TripleStr);
838 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
839 TT.getOS() == llvm::Triple::UnknownOS) {
840 if (TT.getArch() == llvm::Triple::nvptx)
841 return llvm::Triple(
"nvptx-nvidia-cuda");
842 if (TT.getArch() == llvm::Triple::nvptx64)
843 return llvm::Triple(
"nvptx64-nvidia-cuda");
845 return llvm::Triple(
"amdgcn-amd-amdhsa");
858 TC.setEffectiveTriple(std::move(
T));
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::FileType FileType
llvm::MachO::Target Target
Defines the clang::SanitizerKind enum.
The basic abstraction for the target Objective-C runtime.
The base class of the type hierarchy.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
See also MultilibSetBuilder for combining multilibs into a set.
std::vector< std::string > flags_list
Set a ToolChain's effective triple.
~RegisterEffectiveTriple()
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
bool(*)(llvm::ArrayRef< const char * >, llvm::raw_ostream &, llvm::raw_ostream &, bool, bool) Driver
Diagnostic wrappers for TextAPI types for error reporting.
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
ParsedClangName(std::string Suffix, const char *Mode)
ParsedClangName()=default
const char * DriverMode
Corresponding driver mode argument, as '–driver-mode=g++'.
std::string ModeSuffix
Driver mode part of the executable name, as g++.
std::string TargetPrefix
Target part of the executable name, as i686-linux-android.
bool TargetIsValid
True if TargetPrefix is recognized as a registered target name.
ParsedClangName(std::string Target, std::string Suffix, const char *Mode, bool IsRegistered)