9#ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H
10#define LLVM_CLANG_DRIVER_TOOLCHAIN_H
19#include "llvm/ADT/APFloat.h"
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/FloatingPointMode.h"
22#include "llvm/ADT/SmallSet.h"
23#include "llvm/ADT/SmallVector.h"
24#include "llvm/ADT/StringRef.h"
25#include "llvm/Frontend/Debug/Options.h"
26#include "llvm/MC/MCTargetOptions.h"
27#include "llvm/Option/Option.h"
28#include "llvm/Support/VersionTuple.h"
29#include "llvm/Target/TargetOptions.h"
30#include "llvm/TargetParser/Triple.h"
153 const llvm::opt::ArgList &Args;
156 const llvm::opt::Arg *
const CachedRTTIArg;
171 mutable std::unique_ptr<Tool> Clang;
172 mutable std::unique_ptr<Tool> Flang;
173 mutable std::unique_ptr<Tool> Assemble;
174 mutable std::unique_ptr<Tool> Link;
175 mutable std::unique_ptr<Tool> StaticLibTool;
176 mutable std::unique_ptr<Tool> IfsMerge;
177 mutable std::unique_ptr<Tool> OffloadBundler;
178 mutable std::unique_ptr<Tool> OffloadPackager;
179 mutable std::unique_ptr<Tool> LinkerWrapper;
181 Tool *getClang()
const;
182 Tool *getFlang()
const;
183 Tool *getAssemble()
const;
184 Tool *getLink()
const;
185 Tool *getStaticLibTool()
const;
186 Tool *getIfsMerge()
const;
187 Tool *getClangAs()
const;
188 Tool *getOffloadBundler()
const;
189 Tool *getOffloadPackager()
const;
190 Tool *getLinkerWrapper()
const;
194 mutable bool SanitizerArgsChecked =
false;
197 mutable llvm::SmallSet<StringRef, 4> BoundArchSanitizerArgsChecked;
200 mutable llvm::Triple EffectiveTriple;
203 void setEffectiveTriple(llvm::Triple ET)
const {
204 EffectiveTriple = std::move(ET);
207 std::optional<std::string>
208 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
210 mutable std::optional<CXXStdlibType> cxxStdlibType;
211 mutable std::optional<RuntimeLibType> runtimeLibType;
212 mutable std::optional<UnwindLibType> unwindLibType;
213 mutable std::optional<CStdlibType> cStdlibType;
221 llvm::iterator_range<llvm::SmallVector<Multilib>::const_reverse_iterator>;
228 StringRef Fallback = {});
233 StringRef FallbackDir = {});
235 ToolChain(
const Driver &D,
const llvm::Triple &T,
236 const llvm::opt::ArgList &Args);
248 bool IsFortran =
false)
const;
258 llvm::opt::ArgStringList &CC1Args,
261 llvm::opt::ArgStringList &CC1Args,
265 llvm::opt::ArgStringList &CC1Args,
268 llvm::opt::ArgStringList &CC1Args,
271 llvm::opt::ArgStringList &CC1Args,
274 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
275 const Twine &
C =
"",
const Twine &D =
"");
280 llvm::opt::ArgStringList &CC1Args,
287 llvm::vfs::FileSystem &
getVFS()
const;
288 const llvm::Triple &
getTriple()
const {
return Triple; }
302 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
305 StringRef
getOS()
const {
return Triple.getOSName(); }
315 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
316 return EffectiveTriple;
320 return !EffectiveTriple.getTriple().empty();
351 const llvm::opt::ArgList &JobArgs,
BoundArch BA = {},
366 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
400 virtual llvm::opt::DerivedArgList *
410 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
417 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
418 llvm::opt::DerivedArgList *DAL,
424 virtual llvm::opt::DerivedArgList *
446 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
476 bool isUsingLTO(
const llvm::opt::ArgList &Args,
564 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
567 bool IsFortran =
false)
const;
571 llvm::opt::ArgStringList &CmdArgs)
const;
576 llvm::opt::ArgStringList &CmdArgs)
const;
580 llvm::opt::ArgStringList &CmdArgs)
const;
585 bool IsFortran =
false)
const;
650 return llvm::codegenoptions::DIF_DWARF;
681 return llvm::DebuggerKind::GDB;
692 const llvm::opt::ArgList &Args)
const {}
695 virtual llvm::ExceptionHandling
711 const llvm::Triple &TargetTriple,
712 StringRef SysRoot)
const {
713 return TargetTriple.str();
754 llvm::opt::ArgStringList &CC1Args)
const;
759 llvm::opt::ArgStringList &CC1Args,
BoundArch BA,
765 llvm::opt::ArgStringList &CC1ASArgs)
const;
802 llvm::opt::ArgStringList &CC1Args)
const;
807 llvm::opt::ArgStringList &CC1Args)
const;
816 llvm::opt::ArgStringList &CmdArgs)
const;
820 llvm::opt::ArgStringList &CmdArgs)
const;
825 llvm::opt::ArgStringList &CmdArgs)
const;
832 const llvm::opt::ArgList &Args, std::string &Path)
const;
839 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
848 llvm::opt::ArgStringList &CmdArgs)
const;
852 llvm::opt::ArgStringList &CC1Args)
const;
856 llvm::opt::ArgStringList &CC1Args)
const;
860 llvm::opt::ArgStringList &CC1Args)
const;
864 llvm::opt::ArgStringList &CC1Args)
const;
868 const llvm::opt::ArgList &Args)
const;
877 const llvm::opt::ArgList &Args,
878 llvm::opt::ArgStringList &CmdArgs)
const {}
898 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
899 const llvm::fltSemantics *FPType =
nullptr)
const {
900 return llvm::DenormalMode::getIEEE();
907 if (TT.getVendor() == llvm::Triple::UnknownVendor)
908 TT.setVendor(llvm::Triple::NVIDIA);
909 if (TT.getOS() == llvm::Triple::UnknownOS)
910 TT.setOS(llvm::Triple::CUDA);
915 if (TT.getVendor() == llvm::Triple::UnknownVendor)
916 TT.setVendor(llvm::Triple::AMD);
917 if (TT.getOS() == llvm::Triple::UnknownOS)
918 TT.setOS(llvm::Triple::AMDHSA);
924 llvm::Triple TT(OrigTT);
937 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)
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Represents a bound architecture for offload / multiple architecture compilation.
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)