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,
574 return llvm::codegenoptions::DIF_DWARF;
601 return llvm::DebuggerKind::GDB;
612 const llvm::opt::ArgList &Args)
const {}
615 virtual llvm::ExceptionHandling
631 const llvm::Triple &TargetTriple,
632 StringRef SysRoot)
const {
633 return TargetTriple.str();
648 const llvm::opt::ArgList &Args,
674 llvm::opt::ArgStringList &CC1Args)
const;
678 llvm::opt::ArgStringList &CC1Args,
684 llvm::opt::ArgStringList &CC1ASArgs)
const;
709 llvm::opt::ArgStringList &CC1Args)
const;
714 llvm::opt::ArgStringList &CC1Args)
const;
723 llvm::opt::ArgStringList &CmdArgs)
const;
727 llvm::opt::ArgStringList &CmdArgs)
const;
732 llvm::opt::ArgStringList &CmdArgs)
const;
739 const llvm::opt::ArgList &Args, std::string &
Path)
const;
746 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
755 llvm::opt::ArgStringList &CmdArgs)
const;
759 llvm::opt::ArgStringList &CC1Args)
const;
763 llvm::opt::ArgStringList &CC1Args)
const;
767 llvm::opt::ArgStringList &CC1Args)
const;
771 const llvm::opt::ArgList &Args)
const;
780 llvm::opt::ArgStringList &CmdArgs)
const {}
798 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
799 const llvm::fltSemantics *FPType =
nullptr)
const {
800 return llvm::DenormalMode::getIEEE();
806 llvm::Triple TT(TripleStr);
807 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
808 TT.getOS() == llvm::Triple::UnknownOS) {
809 if (TT.getArch() == llvm::Triple::nvptx)
810 return llvm::Triple(
"nvptx-nvidia-cuda");
811 if (TT.getArch() == llvm::Triple::nvptx64)
812 return llvm::Triple(
"nvptx64-nvidia-cuda");
813 if (TT.getArch() == llvm::Triple::amdgcn)
814 return llvm::Triple(
"amdgcn-amd-amdhsa");
827 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.
const FunctionProtoType * T
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)