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"
136 const llvm::opt::ArgList &Args;
139 const llvm::opt::Arg *
const CachedRTTIArg;
152 mutable std::unique_ptr<Tool> Clang;
153 mutable std::unique_ptr<Tool> Flang;
154 mutable std::unique_ptr<Tool> Assemble;
155 mutable std::unique_ptr<Tool> Link;
156 mutable std::unique_ptr<Tool> StaticLibTool;
157 mutable std::unique_ptr<Tool> IfsMerge;
159 mutable std::unique_ptr<Tool> OffloadPackager;
160 mutable std::unique_ptr<Tool> LinkerWrapper;
162 Tool *getClang()
const;
163 Tool *getFlang()
const;
164 Tool *getAssemble()
const;
165 Tool *getLink()
const;
166 Tool *getStaticLibTool()
const;
167 Tool *getIfsMerge()
const;
168 Tool *getClangAs()
const;
169 Tool *getOffloadBundler()
const;
170 Tool *getOffloadPackager()
const;
171 Tool *getLinkerWrapper()
const;
173 mutable bool SanitizerArgsChecked =
false;
174 mutable std::unique_ptr<XRayArgs> XRayArguments;
177 mutable llvm::Triple EffectiveTriple;
180 void setEffectiveTriple(llvm::Triple ET)
const {
181 EffectiveTriple = std::move(ET);
184 mutable std::optional<CXXStdlibType> cxxStdlibType;
185 mutable std::optional<RuntimeLibType> runtimeLibType;
186 mutable std::optional<UnwindLibType> unwindLibType;
193 const llvm::opt::ArgList &Args);
214 llvm::opt::ArgStringList &CC1Args,
217 llvm::opt::ArgStringList &CC1Args,
221 llvm::opt::ArgStringList &CC1Args,
224 llvm::opt::ArgStringList &CC1Args,
227 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
228 const Twine &
C =
"",
const Twine &D =
"");
237 llvm::vfs::FileSystem &
getVFS()
const;
238 const llvm::Triple &
getTriple()
const {
return Triple; }
252 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
255 StringRef
getOS()
const {
return Triple.getOSName(); }
262 return Triple.getTriple();
267 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
268 return EffectiveTriple;
272 return !EffectiveTriple.getTriple().empty();
293 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
324 virtual llvm::opt::DerivedArgList *
334 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
341 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
342 llvm::opt::DerivedArgList *DAL,
348 virtual llvm::opt::DerivedArgList *
370 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
477 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
538 return llvm::codegenoptions::DIF_DWARF;
565 return llvm::DebuggerKind::GDB;
576 const llvm::opt::ArgList &Args)
const {}
579 virtual llvm::ExceptionHandling
595 const llvm::Triple &TargetTriple,
596 StringRef SysRoot)
const {
597 return TargetTriple.str();
612 const llvm::opt::ArgList &Args,
638 llvm::opt::ArgStringList &CC1Args)
const;
642 llvm::opt::ArgStringList &CC1Args,
648 llvm::opt::ArgStringList &CC1ASArgs)
const;
673 llvm::opt::ArgStringList &CC1Args)
const;
678 llvm::opt::ArgStringList &CC1Args)
const;
687 llvm::opt::ArgStringList &CmdArgs)
const;
691 llvm::opt::ArgStringList &CmdArgs)
const;
696 llvm::opt::ArgStringList &CmdArgs)
const;
703 const llvm::opt::ArgList &Args, std::string &Path)
const;
710 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
719 llvm::opt::ArgStringList &CmdArgs)
const;
723 llvm::opt::ArgStringList &CC1Args)
const;
727 llvm::opt::ArgStringList &CC1Args)
const;
731 llvm::opt::ArgStringList &CC1Args)
const;
735 const llvm::opt::ArgList &Args)
const;
744 llvm::opt::ArgStringList &CmdArgs)
const {}
762 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
763 const llvm::fltSemantics *FPType =
nullptr)
const {
764 return llvm::DenormalMode::getIEEE();
770 llvm::Triple TT(TripleStr);
771 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
772 TT.getOS() == llvm::Triple::UnknownOS) {
773 if (TT.getArch() == llvm::Triple::nvptx)
774 return llvm::Triple(
"nvptx-nvidia-cuda");
775 if (TT.getArch() == llvm::Triple::nvptx64)
776 return llvm::Triple(
"nvptx64-nvidia-cuda");
777 if (TT.getArch() == llvm::Triple::amdgcn)
778 return llvm::Triple(
"amdgcn-amd-amdhsa");
791 TC.setEffectiveTriple(std::move(T));
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
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.
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Set a ToolChain's effective triple.
~RegisterEffectiveTriple()
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
@ C
Languages that the frontend can parse and compile.
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)