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"
137 const llvm::opt::ArgList &Args;
140 const llvm::opt::Arg *
const CachedRTTIArg;
153 mutable std::unique_ptr<Tool> Clang;
154 mutable std::unique_ptr<Tool> Flang;
155 mutable std::unique_ptr<Tool> Assemble;
156 mutable std::unique_ptr<Tool> Link;
157 mutable std::unique_ptr<Tool> StaticLibTool;
158 mutable std::unique_ptr<Tool> IfsMerge;
160 mutable std::unique_ptr<Tool> OffloadPackager;
161 mutable std::unique_ptr<Tool> LinkerWrapper;
163 Tool *getClang()
const;
164 Tool *getFlang()
const;
165 Tool *getAssemble()
const;
166 Tool *getLink()
const;
167 Tool *getStaticLibTool()
const;
168 Tool *getIfsMerge()
const;
169 Tool *getClangAs()
const;
170 Tool *getOffloadBundler()
const;
171 Tool *getOffloadPackager()
const;
172 Tool *getLinkerWrapper()
const;
174 mutable bool SanitizerArgsChecked =
false;
175 mutable std::unique_ptr<XRayArgs> XRayArguments;
178 mutable llvm::Triple EffectiveTriple;
181 void setEffectiveTriple(llvm::Triple ET)
const {
182 EffectiveTriple = std::move(ET);
185 std::optional<std::string>
186 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
188 mutable std::optional<CXXStdlibType> cxxStdlibType;
189 mutable std::optional<RuntimeLibType> runtimeLibType;
190 mutable std::optional<UnwindLibType> unwindLibType;
197 const llvm::opt::ArgList &Args);
223 llvm::opt::ArgStringList &CC1Args,
226 llvm::opt::ArgStringList &CC1Args,
230 llvm::opt::ArgStringList &CC1Args,
233 llvm::opt::ArgStringList &CC1Args,
236 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
237 const Twine &
C =
"",
const Twine &D =
"");
246 llvm::vfs::FileSystem &
getVFS()
const;
247 const llvm::Triple &
getTriple()
const {
return Triple; }
261 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
264 StringRef
getOS()
const {
return Triple.getOSName(); }
271 return Triple.getTriple();
276 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
277 return EffectiveTriple;
281 return !EffectiveTriple.getTriple().empty();
316 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
347 virtual llvm::opt::DerivedArgList *
357 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
364 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
365 llvm::opt::DerivedArgList *DAL,
371 virtual llvm::opt::DerivedArgList *
393 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
500 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
561 return llvm::codegenoptions::DIF_DWARF;
588 return llvm::DebuggerKind::GDB;
599 const llvm::opt::ArgList &Args)
const {}
602 virtual llvm::ExceptionHandling
618 const llvm::Triple &TargetTriple,
619 StringRef SysRoot)
const {
620 return TargetTriple.str();
635 const llvm::opt::ArgList &Args,
661 llvm::opt::ArgStringList &CC1Args)
const;
665 llvm::opt::ArgStringList &CC1Args,
671 llvm::opt::ArgStringList &CC1ASArgs)
const;
696 llvm::opt::ArgStringList &CC1Args)
const;
701 llvm::opt::ArgStringList &CC1Args)
const;
710 llvm::opt::ArgStringList &CmdArgs)
const;
714 llvm::opt::ArgStringList &CmdArgs)
const;
719 llvm::opt::ArgStringList &CmdArgs)
const;
726 const llvm::opt::ArgList &Args, std::string &Path)
const;
733 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
742 llvm::opt::ArgStringList &CmdArgs)
const;
746 llvm::opt::ArgStringList &CC1Args)
const;
750 llvm::opt::ArgStringList &CC1Args)
const;
754 llvm::opt::ArgStringList &CC1Args)
const;
758 const llvm::opt::ArgList &Args)
const;
767 llvm::opt::ArgStringList &CmdArgs)
const {}
785 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
786 const llvm::fltSemantics *FPType =
nullptr)
const {
787 return llvm::DenormalMode::getIEEE();
793 llvm::Triple TT(TripleStr);
794 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
795 TT.getOS() == llvm::Triple::UnknownOS) {
796 if (TT.getArch() == llvm::Triple::nvptx)
797 return llvm::Triple(
"nvptx-nvidia-cuda");
798 if (TT.getArch() == llvm::Triple::nvptx64)
799 return llvm::Triple(
"nvptx64-nvidia-cuda");
800 if (TT.getArch() == llvm::Triple::amdgcn)
801 return llvm::Triple(
"amdgcn-amd-amdhsa");
814 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.
std::vector< std::string > flags_list
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)