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"
149 const llvm::opt::ArgList &Args;
152 const llvm::opt::Arg *
const CachedRTTIArg;
167 mutable std::unique_ptr<Tool> Clang;
168 mutable std::unique_ptr<Tool> Flang;
169 mutable std::unique_ptr<Tool> Assemble;
170 mutable std::unique_ptr<Tool> Link;
171 mutable std::unique_ptr<Tool> StaticLibTool;
172 mutable std::unique_ptr<Tool> IfsMerge;
173 mutable std::unique_ptr<Tool> OffloadBundler;
174 mutable std::unique_ptr<Tool> OffloadPackager;
175 mutable std::unique_ptr<Tool> LinkerWrapper;
177 Tool *getClang()
const;
178 Tool *getFlang()
const;
179 Tool *getAssemble()
const;
180 Tool *getLink()
const;
181 Tool *getStaticLibTool()
const;
182 Tool *getIfsMerge()
const;
183 Tool *getClangAs()
const;
184 Tool *getOffloadBundler()
const;
185 Tool *getOffloadPackager()
const;
186 Tool *getLinkerWrapper()
const;
188 mutable bool SanitizerArgsChecked =
false;
191 mutable llvm::Triple EffectiveTriple;
194 void setEffectiveTriple(llvm::Triple ET)
const {
195 EffectiveTriple = std::move(ET);
198 std::optional<std::string>
199 getFallbackAndroidTargetPath(StringRef BaseDir)
const;
201 mutable std::optional<CXXStdlibType> cxxStdlibType;
202 mutable std::optional<RuntimeLibType> runtimeLibType;
203 mutable std::optional<UnwindLibType> unwindLibType;
204 mutable std::optional<CStdlibType> cStdlibType;
211 const llvm::opt::ArgList &Args);
223 bool IsFortran =
false)
const;
233 llvm::opt::ArgStringList &CC1Args,
236 llvm::opt::ArgStringList &CC1Args,
240 llvm::opt::ArgStringList &CC1Args,
243 llvm::opt::ArgStringList &CC1Args,
246 llvm::opt::ArgStringList &CC1Args,
249 static std::string
concat(StringRef Path,
const Twine &A,
const Twine &B =
"",
250 const Twine &
C =
"",
const Twine &D =
"");
255 llvm::opt::ArgStringList &CC1Args,
262 llvm::vfs::FileSystem &
getVFS()
const;
263 const llvm::Triple &
getTriple()
const {
return Triple; }
277 llvm::Triple::ArchType
getArch()
const {
return Triple.getArch(); }
280 StringRef
getOS()
const {
return Triple.getOSName(); }
287 return Triple.getTriple();
292 assert(!EffectiveTriple.getTriple().empty() &&
"No effective triple");
293 return EffectiveTriple;
297 return !EffectiveTriple.getTriple().empty();
332 const llvm::opt::Arg *
getRTTIArg()
const {
return CachedRTTIArg; }
366 virtual llvm::opt::DerivedArgList *
376 const llvm::opt::DerivedArgList &Args,
bool SameTripleAsHost,
383 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
384 llvm::opt::DerivedArgList *DAL,
390 virtual llvm::opt::DerivedArgList *
412 std::string
GetLinkerPath(
bool *LinkerIsLLD =
nullptr)
const;
519 virtual std::string
getCompilerRT(
const llvm::opt::ArgList &Args,
522 bool IsFortran =
false)
const;
526 llvm::opt::ArgStringList &CmdArgs)
const;
531 llvm::opt::ArgStringList &CmdArgs)
const;
535 llvm::opt::ArgStringList &CmdArgs)
const;
540 bool IsFortran =
false)
const;
601 return llvm::codegenoptions::DIF_DWARF;
632 return llvm::DebuggerKind::GDB;
643 const llvm::opt::ArgList &Args)
const {}
646 virtual llvm::ExceptionHandling
662 const llvm::Triple &TargetTriple,
663 StringRef SysRoot)
const {
664 return TargetTriple.str();
679 const llvm::opt::ArgList &Args,
705 llvm::opt::ArgStringList &CC1Args)
const;
709 llvm::opt::ArgStringList &CC1Args,
715 llvm::opt::ArgStringList &CC1ASArgs)
const;
752 llvm::opt::ArgStringList &CC1Args)
const;
757 llvm::opt::ArgStringList &CC1Args)
const;
766 llvm::opt::ArgStringList &CmdArgs)
const;
770 llvm::opt::ArgStringList &CmdArgs)
const;
775 llvm::opt::ArgStringList &CmdArgs)
const;
782 const llvm::opt::ArgList &Args, std::string &Path)
const;
789 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
const;
798 llvm::opt::ArgStringList &CmdArgs)
const;
802 llvm::opt::ArgStringList &CC1Args)
const;
806 llvm::opt::ArgStringList &CC1Args)
const;
810 llvm::opt::ArgStringList &CC1Args)
const;
814 llvm::opt::ArgStringList &CC1Args)
const;
818 const llvm::opt::ArgList &Args)
const;
827 const llvm::opt::ArgList &Args,
828 llvm::opt::ArgStringList &CmdArgs)
const {}
846 const llvm::opt::ArgList &DriverArgs,
const JobAction &JA,
847 const llvm::fltSemantics *FPType =
nullptr)
const {
848 return llvm::DenormalMode::getIEEE();
854 llvm::Triple TT(TripleStr);
855 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
856 TT.getOS() == llvm::Triple::UnknownOS) {
857 if (TT.getArch() == llvm::Triple::nvptx)
858 return llvm::Triple(
"nvptx-nvidia-cuda");
859 if (TT.getArch() == llvm::Triple::nvptx64)
860 return llvm::Triple(
"nvptx64-nvidia-cuda");
862 return llvm::Triple(
"amdgcn-amd-amdhsa");
875 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)
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)