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;
182 mutable std::unique_ptr<XRayArgs> XRayArguments;
185 mutable llvm::Triple EffectiveTriple;
188 void setEffectiveTriple(llvm::Triple ET)
const {
189 EffectiveTriple = std::move(ET);
192 std::optional<std::string>
193 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
195 mutable std::optional<CXXStdlibType> cxxStdlibType;
196 mutable std::optional<RuntimeLibType> runtimeLibType;
197 mutable std::optional<UnwindLibType> unwindLibType;
204 const llvm::opt::ArgList &Args);
230 llvm::opt::ArgStringList &CC1Args,
233 llvm::opt::ArgStringList &CC1Args,
237 llvm::opt::ArgStringList &CC1Args,
240 llvm::opt::ArgStringList &CC1Args,
243 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
244 const Twine &
C =
"",
const Twine &D =
"");
253 llvm::vfs::FileSystem &
getVFS()
const;
254 const llvm::Triple &
getTriple()
const {
return Triple; }
268 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
271 StringRef
getOS()
const {
return Triple.getOSName(); }
278 return Triple.getTriple();
283 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
284 return EffectiveTriple;
288 return !EffectiveTriple.getTriple().empty();
323 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
357 virtual llvm::opt::DerivedArgList *
367 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
374 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
375 llvm::opt::DerivedArgList *DAL,
381 virtual llvm::opt::DerivedArgList *
403 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
510 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
571 return llvm::codegenoptions::DIF_DWARF;
598 return llvm::DebuggerKind::GDB;
609 const llvm::opt::ArgList &Args)
const {}
612 virtual llvm::ExceptionHandling
628 const llvm::Triple &TargetTriple,
629 StringRef SysRoot)
const {
630 return TargetTriple.str();
645 const llvm::opt::ArgList &Args,
671 llvm::opt::ArgStringList &CC1Args)
const;
675 llvm::opt::ArgStringList &CC1Args,
681 llvm::opt::ArgStringList &CC1ASArgs)
const;
706 llvm::opt::ArgStringList &CC1Args)
const;
711 llvm::opt::ArgStringList &CC1Args)
const;
720 llvm::opt::ArgStringList &CmdArgs)
const;
724 llvm::opt::ArgStringList &CmdArgs)
const;
729 llvm::opt::ArgStringList &CmdArgs)
const;
736 const llvm::opt::ArgList &Args, std::string &Path)
const;
743 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
752 llvm::opt::ArgStringList &CmdArgs)
const;
756 llvm::opt::ArgStringList &CC1Args)
const;
760 llvm::opt::ArgStringList &CC1Args)
const;
764 llvm::opt::ArgStringList &CC1Args)
const;
768 const llvm::opt::ArgList &Args)
const;
777 llvm::opt::ArgStringList &CmdArgs)
const {}
795 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
796 const llvm::fltSemantics *FPType =
nullptr)
const {
797 return llvm::DenormalMode::getIEEE();
803 llvm::Triple TT(TripleStr);
804 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
805 TT.getOS() == llvm::Triple::UnknownOS) {
806 if (TT.getArch() == llvm::Triple::nvptx)
807 return llvm::Triple(
"nvptx-nvidia-cuda");
808 if (TT.getArch() == llvm::Triple::nvptx64)
809 return llvm::Triple(
"nvptx64-nvidia-cuda");
810 if (TT.getArch() == llvm::Triple::amdgcn)
811 return llvm::Triple(
"amdgcn-amd-amdhsa");
824 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.
YAML serialization mapping.
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)