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/SmallSet.h"
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/Frontend/Debug/Options.h"
25#include "llvm/MC/MCTargetOptions.h"
26#include "llvm/Option/Option.h"
27#include "llvm/Support/VersionTuple.h"
28#include "llvm/Target/TargetOptions.h"
29#include "llvm/TargetParser/Triple.h"
152 const llvm::opt::ArgList &Args;
155 const llvm::opt::Arg *
const CachedRTTIArg;
170 mutable std::unique_ptr<Tool> Clang;
171 mutable std::unique_ptr<Tool> Flang;
172 mutable std::unique_ptr<Tool> Assemble;
173 mutable std::unique_ptr<Tool> Link;
174 mutable std::unique_ptr<Tool> StaticLibTool;
175 mutable std::unique_ptr<Tool> IfsMerge;
176 mutable std::unique_ptr<Tool> OffloadBundler;
177 mutable std::unique_ptr<Tool> OffloadPackager;
178 mutable std::unique_ptr<Tool> LinkerWrapper;
180 Tool *getClang()
const;
181 Tool *getFlang()
const;
182 Tool *getAssemble()
const;
183 Tool *getLink()
const;
184 Tool *getStaticLibTool()
const;
185 Tool *getIfsMerge()
const;
186 Tool *getClangAs()
const;
187 Tool *getOffloadBundler()
const;
188 Tool *getOffloadPackager()
const;
189 Tool *getLinkerWrapper()
const;
193 mutable bool SanitizerArgsChecked =
false;
196 mutable llvm::SmallSet<StringRef, 4> BoundArchSanitizerArgsChecked;
199 mutable llvm::Triple EffectiveTriple;
202 void setEffectiveTriple(llvm::Triple ET)
const {
203 EffectiveTriple = std::move(ET);
206 std::optional<std::string>
207 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
209 mutable std::optional<CXXStdlibType> cxxStdlibType;
210 mutable std::optional<RuntimeLibType> runtimeLibType;
211 mutable std::optional<UnwindLibType> unwindLibType;
212 mutable std::optional<CStdlibType> cStdlibType;
220 llvm::iterator_range<llvm::SmallVector<Multilib>::const_reverse_iterator>;
227 StringRef Fallback = {});
232 StringRef FallbackDir = {});
234 ToolChain(
const Driver &D,
const llvm::Triple &T,
235 const llvm::opt::ArgList &Args);
247 bool IsFortran =
false)
const;
257 llvm::opt::ArgStringList &CC1Args,
260 llvm::opt::ArgStringList &CC1Args,
264 llvm::opt::ArgStringList &CC1Args,
267 llvm::opt::ArgStringList &CC1Args,
270 llvm::opt::ArgStringList &CC1Args,
273 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
274 const Twine &
C =
"",
const Twine &D =
"");
279 llvm::opt::ArgStringList &CC1Args,
286 llvm::vfs::FileSystem &
getVFS()
const;
287 const llvm::Triple &
getTriple()
const {
return Triple; }
301 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
304 StringRef
getOS()
const {
return Triple.getOSName(); }
314 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
315 return EffectiveTriple;
319 return !EffectiveTriple.getTriple().empty();
350 const llvm::opt::ArgList &JobArgs, StringRef BoundArch =
"",
358 StringRef BoundArch)
const {
365 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
399 virtual llvm::opt::DerivedArgList *
409 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
416 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
417 llvm::opt::DerivedArgList *DAL,
423 virtual llvm::opt::DerivedArgList *
445 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
475 bool isUsingLTO(
const llvm::opt::ArgList &Args,
563 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
566 bool IsFortran =
false)
const;
570 llvm::opt::ArgStringList &CmdArgs)
const;
575 llvm::opt::ArgStringList &CmdArgs)
const;
579 llvm::opt::ArgStringList &CmdArgs)
const;
584 bool IsFortran =
false)
const;
649 return llvm::codegenoptions::DIF_DWARF;
680 return llvm::DebuggerKind::GDB;
691 const llvm::opt::ArgList &Args)
const {}
694 virtual llvm::ExceptionHandling
710 const llvm::Triple &TargetTriple,
711 StringRef SysRoot)
const {
712 return TargetTriple.str();
728 StringRef BoundArch = {},
754 llvm::opt::ArgStringList &CC1Args)
const;
758 llvm::opt::ArgStringList &CC1Args,
764 llvm::opt::ArgStringList &CC1ASArgs)
const;
801 llvm::opt::ArgStringList &CC1Args)
const;
806 llvm::opt::ArgStringList &CC1Args)
const;
815 llvm::opt::ArgStringList &CmdArgs)
const;
819 llvm::opt::ArgStringList &CmdArgs)
const;
824 llvm::opt::ArgStringList &CmdArgs)
const;
831 const llvm::opt::ArgList &Args, std::string &Path)
const;
838 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
847 llvm::opt::ArgStringList &CmdArgs)
const;
851 llvm::opt::ArgStringList &CC1Args)
const;
855 llvm::opt::ArgStringList &CC1Args)
const;
859 llvm::opt::ArgStringList &CC1Args)
const;
863 llvm::opt::ArgStringList &CC1Args)
const;
867 const llvm::opt::ArgList &Args)
const;
876 const llvm::opt::ArgList &Args,
877 llvm::opt::ArgStringList &CmdArgs)
const {}
897 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
898 const llvm::fltSemantics *FPType =
nullptr)
const {
899 return llvm::DenormalMode::getIEEE();
906 if (TT.getVendor() == llvm::Triple::UnknownVendor)
907 TT.setVendor(llvm::Triple::NVIDIA);
908 if (TT.getOS() == llvm::Triple::UnknownOS)
909 TT.setOS(llvm::Triple::CUDA);
914 if (TT.getVendor() == llvm::Triple::UnknownVendor)
915 TT.setVendor(llvm::Triple::AMD);
916 if (TT.getOS() == llvm::Triple::UnknownOS)
917 TT.setOS(llvm::Triple::AMDHSA);
923 llvm::Triple TT(OrigTT);
936 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.
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)