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"
149 const llvm::opt::ArgList &Args;
152 const llvm::opt::Arg *
const CachedRTTIArg;
167 mutable std::unique_ptr<Tool> Clang;
168 mutable std::unique_ptr<Tool> Flang;
169 mutable std::unique_ptr<Tool> Assemble;
170 mutable std::unique_ptr<Tool> Link;
171 mutable std::unique_ptr<Tool> StaticLibTool;
172 mutable std::unique_ptr<Tool> IfsMerge;
173 mutable std::unique_ptr<Tool> OffloadBundler;
174 mutable std::unique_ptr<Tool> OffloadPackager;
175 mutable std::unique_ptr<Tool> LinkerWrapper;
177 Tool *getClang()
const;
178 Tool *getFlang()
const;
179 Tool *getAssemble()
const;
180 Tool *getLink()
const;
181 Tool *getStaticLibTool()
const;
182 Tool *getIfsMerge()
const;
183 Tool *getClangAs()
const;
184 Tool *getOffloadBundler()
const;
185 Tool *getOffloadPackager()
const;
186 Tool *getLinkerWrapper()
const;
188 mutable bool SanitizerArgsChecked =
false;
191 mutable llvm::Triple EffectiveTriple;
194 void setEffectiveTriple(llvm::Triple ET)
const {
195 EffectiveTriple = std::move(ET);
198 std::optional<std::string>
199 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
201 mutable std::optional<CXXStdlibType> cxxStdlibType;
202 mutable std::optional<RuntimeLibType> runtimeLibType;
203 mutable std::optional<UnwindLibType> unwindLibType;
204 mutable std::optional<CStdlibType> cStdlibType;
212 llvm::iterator_range<llvm::SmallVector<Multilib>::const_reverse_iterator>;
219 StringRef Fallback = {});
224 StringRef FallbackDir = {});
226 ToolChain(
const Driver &D,
const llvm::Triple &T,
227 const llvm::opt::ArgList &Args);
239 bool IsFortran =
false)
const;
249 llvm::opt::ArgStringList &CC1Args,
252 llvm::opt::ArgStringList &CC1Args,
256 llvm::opt::ArgStringList &CC1Args,
259 llvm::opt::ArgStringList &CC1Args,
262 llvm::opt::ArgStringList &CC1Args,
265 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
266 const Twine &
C =
"",
const Twine &D =
"");
271 llvm::opt::ArgStringList &CC1Args,
278 llvm::vfs::FileSystem &
getVFS()
const;
279 const llvm::Triple &
getTriple()
const {
return Triple; }
293 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
296 StringRef
getOS()
const {
return Triple.getOSName(); }
306 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
307 return EffectiveTriple;
311 return !EffectiveTriple.getTriple().empty();
346 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
380 virtual llvm::opt::DerivedArgList *
390 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
397 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
398 llvm::opt::DerivedArgList *DAL,
404 virtual llvm::opt::DerivedArgList *
426 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
533 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
536 bool IsFortran =
false)
const;
540 llvm::opt::ArgStringList &CmdArgs)
const;
545 llvm::opt::ArgStringList &CmdArgs)
const;
549 llvm::opt::ArgStringList &CmdArgs)
const;
554 bool IsFortran =
false)
const;
615 return llvm::codegenoptions::DIF_DWARF;
646 return llvm::DebuggerKind::GDB;
657 const llvm::opt::ArgList &Args)
const {}
660 virtual llvm::ExceptionHandling
676 const llvm::Triple &TargetTriple,
677 StringRef SysRoot)
const {
678 return TargetTriple.str();
693 const llvm::opt::ArgList &Args,
719 llvm::opt::ArgStringList &CC1Args)
const;
723 llvm::opt::ArgStringList &CC1Args,
729 llvm::opt::ArgStringList &CC1ASArgs)
const;
766 llvm::opt::ArgStringList &CC1Args)
const;
771 llvm::opt::ArgStringList &CC1Args)
const;
780 llvm::opt::ArgStringList &CmdArgs)
const;
784 llvm::opt::ArgStringList &CmdArgs)
const;
789 llvm::opt::ArgStringList &CmdArgs)
const;
796 const llvm::opt::ArgList &Args, std::string &Path)
const;
803 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
812 llvm::opt::ArgStringList &CmdArgs)
const;
816 llvm::opt::ArgStringList &CC1Args)
const;
820 llvm::opt::ArgStringList &CC1Args)
const;
824 llvm::opt::ArgStringList &CC1Args)
const;
828 llvm::opt::ArgStringList &CC1Args)
const;
832 const llvm::opt::ArgList &Args)
const;
841 const llvm::opt::ArgList &Args,
842 llvm::opt::ArgStringList &CmdArgs)
const {}
860 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
861 const llvm::fltSemantics *FPType =
nullptr)
const {
862 return llvm::DenormalMode::getIEEE();
869 if (TT.getVendor() == llvm::Triple::UnknownVendor)
870 TT.setVendor(llvm::Triple::NVIDIA);
871 if (TT.getOS() == llvm::Triple::UnknownOS)
872 TT.setOS(llvm::Triple::CUDA);
877 if (TT.getVendor() == llvm::Triple::UnknownVendor)
878 TT.setVendor(llvm::Triple::AMD);
879 if (TT.getOS() == llvm::Triple::UnknownOS)
880 TT.setOS(llvm::Triple::AMDHSA);
886 llvm::Triple TT(OrigTT);
899 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
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
~RegisterEffectiveTriple()
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
The JSON file list parser is used to communicate input to InstallAPI.
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)