clang  16.0.0git
ToolChain.h
Go to the documentation of this file.
1 //===- ToolChain.h - Collections of tools for one platform ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H
10 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
11 
13 #include "clang/Basic/LLVM.h"
15 #include "clang/Basic/Sanitizers.h"
16 #include "clang/Driver/Action.h"
17 #include "clang/Driver/Multilib.h"
18 #include "clang/Driver/Types.h"
19 #include "llvm/ADT/APFloat.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/FloatingPointMode.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/ADT/Triple.h"
25 #include "llvm/MC/MCTargetOptions.h"
26 #include "llvm/Option/Option.h"
27 #include "llvm/Support/VersionTuple.h"
28 #include "llvm/Target/TargetOptions.h"
29 #include <cassert>
30 #include <climits>
31 #include <memory>
32 #include <string>
33 #include <utility>
34 
35 namespace llvm {
36 namespace opt {
37 
38 class Arg;
39 class ArgList;
40 class DerivedArgList;
41 
42 } // namespace opt
43 namespace vfs {
44 
45 class FileSystem;
46 
47 } // namespace vfs
48 } // namespace llvm
49 
50 namespace clang {
51 
52 class ObjCRuntime;
53 
54 namespace driver {
55 
56 class Driver;
57 class InputInfo;
58 class SanitizerArgs;
59 class Tool;
60 class XRayArgs;
61 
62 /// Helper structure used to pass information extracted from clang executable
63 /// name such as `i686-linux-android-g++`.
65  /// Target part of the executable name, as `i686-linux-android`.
67 
68  /// Driver mode part of the executable name, as `g++`.
70 
71  /// Corresponding driver mode argument, as '--driver-mode=g++'
72  const char *DriverMode = nullptr;
73 
74  /// True if TargetPrefix is recognized as a registered target name.
75  bool TargetIsValid = false;
76 
77  ParsedClangName() = default;
78  ParsedClangName(std::string Suffix, const char *Mode)
79  : ModeSuffix(Suffix), DriverMode(Mode) {}
80  ParsedClangName(std::string Target, std::string Suffix, const char *Mode,
81  bool IsRegistered)
82  : TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
83  TargetIsValid(IsRegistered) {}
84 
85  bool isEmpty() const {
86  return TargetPrefix.empty() && ModeSuffix.empty() && DriverMode == nullptr;
87  }
88 };
89 
90 /// ToolChain - Access to tools for a single platform.
91 class ToolChain {
92 public:
94 
98  };
99 
103  };
104 
109  };
110 
111  enum class UnwindTableLevel {
112  None,
113  Synchronous,
114  Asynchronous,
115  };
116 
117  enum RTTIMode {
120  };
121 
125  BitCodeLibraryInfo(StringRef Path, bool ShouldInternalize = true)
127  };
128 
130 
131 private:
133 
134  const Driver &D;
135  llvm::Triple Triple;
136  const llvm::opt::ArgList &Args;
137 
138  // We need to initialize CachedRTTIArg before CachedRTTIMode
139  const llvm::opt::Arg *const CachedRTTIArg;
140 
141  const RTTIMode CachedRTTIMode;
142 
143  /// The list of toolchain specific path prefixes to search for libraries.
144  path_list LibraryPaths;
145 
146  /// The list of toolchain specific path prefixes to search for files.
147  path_list FilePaths;
148 
149  /// The list of toolchain specific path prefixes to search for programs.
150  path_list ProgramPaths;
151 
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;
158  mutable std::unique_ptr<Tool> OffloadBundler;
159  mutable std::unique_ptr<Tool> OffloadPackager;
160  mutable std::unique_ptr<Tool> LinkerWrapper;
161 
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;
172 
173  mutable bool SanitizerArgsChecked = false;
174  mutable std::unique_ptr<XRayArgs> XRayArguments;
175 
176  /// The effective clang triple for the current Job.
177  mutable llvm::Triple EffectiveTriple;
178 
179  /// Set the toolchain's effective clang triple.
180  void setEffectiveTriple(llvm::Triple ET) const {
181  EffectiveTriple = std::move(ET);
182  }
183 
184  mutable llvm::Optional<CXXStdlibType> cxxStdlibType;
185  mutable llvm::Optional<RuntimeLibType> runtimeLibType;
186  mutable llvm::Optional<UnwindLibType> unwindLibType;
187 
188 protected:
191 
192  ToolChain(const Driver &D, const llvm::Triple &T,
193  const llvm::opt::ArgList &Args);
194 
195  void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
196 
197  virtual Tool *buildAssembler() const;
198  virtual Tool *buildLinker() const;
199  virtual Tool *buildStaticLibTool() const;
200  virtual Tool *getTool(Action::ActionClass AC) const;
201 
202  virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args,
203  StringRef Component,
204  FileType Type,
205  bool AddArch) const;
206 
207  /// \name Utilities for implementing subclasses.
208  ///@{
209  static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
210  llvm::opt::ArgStringList &CC1Args,
211  const Twine &Path);
212  static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
213  llvm::opt::ArgStringList &CC1Args,
214  const Twine &Path);
215  static void
216  addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
217  llvm::opt::ArgStringList &CC1Args,
218  const Twine &Path);
219  static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
220  llvm::opt::ArgStringList &CC1Args,
221  ArrayRef<StringRef> Paths);
222 
223  static std::string concat(StringRef Path, const Twine &A, const Twine &B = "",
224  const Twine &C = "", const Twine &D = "");
225  ///@}
226 
227 public:
228  virtual ~ToolChain();
229 
230  // Accessors
231 
232  const Driver &getDriver() const { return D; }
233  llvm::vfs::FileSystem &getVFS() const;
234  const llvm::Triple &getTriple() const { return Triple; }
235 
236  /// Get the toolchain's aux triple, if it has one.
237  ///
238  /// Exactly what the aux triple represents depends on the toolchain, but for
239  /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
240  /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
241  virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
242 
243  /// Some toolchains need to modify the file name, for example to replace the
244  /// extension for object files with .cubin for OpenMP offloading to Nvidia
245  /// GPUs.
246  virtual std::string getInputFilename(const InputInfo &Input) const;
247 
248  llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
249  StringRef getArchName() const { return Triple.getArchName(); }
250  StringRef getPlatform() const { return Triple.getVendorName(); }
251  StringRef getOS() const { return Triple.getOSName(); }
252 
253  /// Provide the default architecture name (as expected by -arch) for
254  /// this toolchain.
255  StringRef getDefaultUniversalArchName() const;
256 
258  return Triple.getTriple();
259  }
260 
261  /// Get the toolchain's effective clang triple.
262  const llvm::Triple &getEffectiveTriple() const {
263  assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
264  return EffectiveTriple;
265  }
266 
267  bool hasEffectiveTriple() const {
268  return !EffectiveTriple.getTriple().empty();
269  }
270 
271  path_list &getLibraryPaths() { return LibraryPaths; }
272  const path_list &getLibraryPaths() const { return LibraryPaths; }
273 
274  path_list &getFilePaths() { return FilePaths; }
275  const path_list &getFilePaths() const { return FilePaths; }
276 
277  path_list &getProgramPaths() { return ProgramPaths; }
278  const path_list &getProgramPaths() const { return ProgramPaths; }
279 
280  const MultilibSet &getMultilibs() const { return Multilibs; }
281 
282  const Multilib &getMultilib() const { return SelectedMultilib; }
283 
284  SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const;
285 
286  const XRayArgs& getXRayArgs() const;
287 
288  // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
289  const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
290 
291  // Returns the RTTIMode for the toolchain with the current arguments.
292  RTTIMode getRTTIMode() const { return CachedRTTIMode; }
293 
294  /// Return any implicit target and/or mode flag for an invocation of
295  /// the compiler driver as `ProgName`.
296  ///
297  /// For example, when called with i686-linux-android-g++, the first element
298  /// of the return value will be set to `"i686-linux-android"` and the second
299  /// will be set to "--driver-mode=g++"`.
300  /// It is OK if the target name is not registered. In this case the return
301  /// value contains false in the field TargetIsValid.
302  ///
303  /// \pre `llvm::InitializeAllTargets()` has been called.
304  /// \param ProgName The name the Clang driver was invoked with (from,
305  /// e.g., argv[0]).
306  /// \return A structure of type ParsedClangName that contains the executable
307  /// name parts.
308  static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName);
309 
310  // Tool access.
311 
312  /// TranslateArgs - Create a new derived argument list for any argument
313  /// translations this ToolChain may wish to perform, or 0 if no tool chain
314  /// specific translations are needed. If \p DeviceOffloadKind is specified
315  /// the translation specific for that offload kind is performed.
316  ///
317  /// \param BoundArch - The bound architecture name, or 0.
318  /// \param DeviceOffloadKind - The device offload kind used for the
319  /// translation.
320  virtual llvm::opt::DerivedArgList *
321  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
322  Action::OffloadKind DeviceOffloadKind) const {
323  return nullptr;
324  }
325 
326  /// TranslateOpenMPTargetArgs - Create a new derived argument list for
327  /// that contains the OpenMP target specific flags passed via
328  /// -Xopenmp-target -opt=val OR -Xopenmp-target=<triple> -opt=val
329  virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
330  const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
331  SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
332 
333  /// Append the argument following \p A to \p DAL assuming \p A is an Xarch
334  /// argument. If \p AllocatedArgs is null pointer, synthesized arguments are
335  /// added to \p DAL, otherwise they are appended to \p AllocatedArgs.
336  virtual void TranslateXarchArgs(
337  const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
338  llvm::opt::DerivedArgList *DAL,
339  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs = nullptr) const;
340 
341  /// Translate -Xarch_ arguments. If there are no such arguments, return
342  /// a null pointer, otherwise return a DerivedArgList containing the
343  /// translated arguments.
344  virtual llvm::opt::DerivedArgList *
345  TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
346  Action::OffloadKind DeviceOffloadKind,
347  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const;
348 
349  /// Choose a tool to use to handle the action \p JA.
350  ///
351  /// This can be overridden when a particular ToolChain needs to use
352  /// a compiler other than Clang.
353  virtual Tool *SelectTool(const JobAction &JA) const;
354 
355  // Helper methods
356 
357  std::string GetFilePath(const char *Name) const;
358  std::string GetProgramPath(const char *Name) const;
359 
360  /// Returns the linker path, respecting the -fuse-ld= argument to determine
361  /// the linker suffix or name.
362  /// If LinkerIsLLD is non-nullptr, it is set to true if the returned linker
363  /// is LLD. If it's set, it can be assumed that the linker is LLD built
364  /// at the same revision as clang, and clang can make assumptions about
365  /// LLD's supported flags, error output, etc.
366  std::string GetLinkerPath(bool *LinkerIsLLD = nullptr) const;
367 
368  /// Returns the linker path for emitting a static library.
370 
371  /// Dispatch to the specific toolchain for verbose printing.
372  ///
373  /// This is used when handling the verbose option to print detailed,
374  /// toolchain-specific information useful for understanding the behavior of
375  /// the driver on a specific platform.
376  virtual void printVerboseInfo(raw_ostream &OS) const {}
377 
378  // Platform defaults information
379 
380  /// Returns true if the toolchain is targeting a non-native
381  /// architecture.
382  virtual bool isCrossCompiling() const;
383 
384  /// HasNativeLTOLinker - Check whether the linker and related tools have
385  /// native LLVM support.
386  virtual bool HasNativeLLVMSupport() const;
387 
388  /// LookupTypeForExtension - Return the default language type to use for the
389  /// given extension.
390  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
391 
392  /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
393  virtual bool IsBlocksDefault() const { return false; }
394 
395  /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
396  /// by default.
397  virtual bool IsIntegratedAssemblerDefault() const { return false; }
398 
399  /// IsIntegratedBackendDefault - Does this tool chain enable
400  /// -fintegrated-objemitter by default.
401  virtual bool IsIntegratedBackendDefault() const { return true; }
402 
403  /// IsIntegratedBackendSupported - Does this tool chain support
404  /// -fintegrated-objemitter.
405  virtual bool IsIntegratedBackendSupported() const { return true; }
406 
407  /// IsNonIntegratedBackendSupported - Does this tool chain support
408  /// -fno-integrated-objemitter.
409  virtual bool IsNonIntegratedBackendSupported() const { return false; }
410 
411  /// Check if the toolchain should use the integrated assembler.
412  virtual bool useIntegratedAs() const;
413 
414  /// Check if the toolchain should use the integrated backend.
415  virtual bool useIntegratedBackend() const;
416 
417  /// Check if the toolchain should use AsmParser to parse inlineAsm when
418  /// integrated assembler is not default.
419  virtual bool parseInlineAsmUsingAsmParser() const { return false; }
420 
421  /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
422  virtual bool IsMathErrnoDefault() const { return true; }
423 
424  /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
425  /// -fencode-extended-block-signature by default.
426  virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
427 
428  /// IsObjCNonFragileABIDefault - Does this tool chain set
429  /// -fobjc-nonfragile-abi by default.
430  virtual bool IsObjCNonFragileABIDefault() const { return false; }
431 
432  /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
433  /// mixed dispatch method be used?
434  virtual bool UseObjCMixedDispatch() const { return false; }
435 
436  /// Check whether to enable x86 relax relocations by default.
437  virtual bool useRelaxRelocations() const;
438 
439  /// Check whether use IEEE binary128 as long double format by default.
440  bool defaultToIEEELongDouble() const;
441 
442  /// GetDefaultStackProtectorLevel - Get the default stack protector level for
443  /// this tool chain.
445  GetDefaultStackProtectorLevel(bool KernelOrKext) const {
446  return LangOptions::SSPOff;
447  }
448 
449  /// Get the default trivial automatic variable initialization.
453  }
454 
455  /// GetDefaultLinker - Get the default linker to use.
456  virtual const char *getDefaultLinker() const { return "ld"; }
457 
458  /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
460  return ToolChain::RLT_Libgcc;
461  }
462 
465  }
466 
468  return ToolChain::UNW_None;
469  }
470 
471  virtual std::string getCompilerRTPath() const;
472 
473  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
474  StringRef Component,
476 
477  const char *
478  getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
480 
481  std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
482  StringRef Component,
484 
485  // Returns target specific runtime paths.
486  path_list getRuntimePaths() const;
487 
488  // Returns target specific standard library paths.
489  path_list getStdlibPaths() const;
490 
491  // Returns <ResourceDir>/lib/<OSName>/<arch>. This is used by runtimes (such
492  // as OpenMP) to find arch-specific libraries.
494 
495  // Returns <OSname> part of above.
496  virtual StringRef getOSLibName() const;
497 
498  /// needsProfileRT - returns true if instrumentation profile is on.
499  static bool needsProfileRT(const llvm::opt::ArgList &Args);
500 
501  /// Returns true if gcov instrumentation (-fprofile-arcs or --coverage) is on.
502  static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args);
503 
504  /// How detailed should the unwind tables be by default.
505  virtual UnwindTableLevel
506  getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const;
507 
508  /// Test whether this toolchain supports outline atomics by default.
509  virtual bool
510  IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const {
511  return false;
512  }
513 
514  /// Test whether this toolchain defaults to PIC.
515  virtual bool isPICDefault() const = 0;
516 
517  /// Test whether this toolchain defaults to PIE.
518  virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const = 0;
519 
520  /// Tests whether this toolchain forces its default for PIC, PIE or
521  /// non-PIC. If this returns true, any PIC related flags should be ignored
522  /// and instead the results of \c isPICDefault() and \c isPIEDefault(const
523  /// llvm::opt::ArgList &Args) are used exclusively.
524  virtual bool isPICDefaultForced() const = 0;
525 
526  /// SupportsProfiling - Does this tool chain support -pg.
527  virtual bool SupportsProfiling() const { return true; }
528 
529  /// Complain if this tool chain doesn't support Objective-C ARC.
530  virtual void CheckObjCARC() const {}
531 
532  /// Get the default debug info format. Typically, this is DWARF.
535  }
536 
537  /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
538  /// compile unit information.
539  virtual bool UseDwarfDebugFlags() const { return false; }
540 
541  /// Add an additional -fdebug-prefix-map entry.
542  virtual std::string GetGlobalDebugPathRemapping() const { return {}; }
543 
544  // Return the DWARF version to emit, in the absence of arguments
545  // to the contrary.
546  virtual unsigned GetDefaultDwarfVersion() const { return 5; }
547 
548  // Some toolchains may have different restrictions on the DWARF version and
549  // may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
550  // compilation uses DWARF5.
551  virtual unsigned getMaxDwarfVersion() const { return UINT_MAX; }
552 
553  // True if the driver should assume "-fstandalone-debug"
554  // in the absence of an option specifying otherwise,
555  // provided that debugging was requested in the first place.
556  // i.e. a value of 'true' does not imply that debugging is wanted.
557  virtual bool GetDefaultStandaloneDebug() const { return false; }
558 
559  // Return the default debugger "tuning."
560  virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
561  return llvm::DebuggerKind::GDB;
562  }
563 
564  /// Does this toolchain supports given debug info option or not.
565  virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
566  return true;
567  }
568 
569  /// Adjust debug information kind considering all passed options.
571  const llvm::opt::ArgList &Args) const {}
572 
573  /// GetExceptionModel - Return the tool chain exception model.
574  virtual llvm::ExceptionHandling
575  GetExceptionModel(const llvm::opt::ArgList &Args) const;
576 
577  /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
578  virtual bool SupportsEmbeddedBitcode() const { return false; }
579 
580  /// getThreadModel() - Which thread model does this target use?
581  virtual std::string getThreadModel() const { return "posix"; }
582 
583  /// isThreadModelSupported() - Does this target support a thread model?
584  virtual bool isThreadModelSupported(const StringRef Model) const;
585 
586  /// isBareMetal - Is this a bare metal target.
587  virtual bool isBareMetal() const { return false; }
588 
590  const llvm::Triple &TargetTriple,
591  StringRef SysRoot) const {
592  return TargetTriple.str();
593  }
594 
595  /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
596  /// command line arguments into account.
597  virtual std::string
598  ComputeLLVMTriple(const llvm::opt::ArgList &Args,
599  types::ID InputType = types::TY_INVALID) const;
600 
601  /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
602  /// target, which may take into account the command line arguments. For
603  /// example, on Darwin the -mmacosx-version-min= command line argument (which
604  /// sets the deployment target) determines the version in the triple passed to
605  /// Clang.
607  const llvm::opt::ArgList &Args,
608  types::ID InputType = types::TY_INVALID) const;
609 
610  /// getDefaultObjCRuntime - Return the default Objective-C runtime
611  /// for this platform.
612  ///
613  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
614  virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
615 
616  /// hasBlocksRuntime - Given that the user is compiling with
617  /// -fblocks, does this tool chain guarantee the existence of a
618  /// blocks runtime?
619  ///
620  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
621  virtual bool hasBlocksRuntime() const { return true; }
622 
623  /// Return the sysroot, possibly searching for a default sysroot using
624  /// target-specific logic.
625  virtual std::string computeSysRoot() const;
626 
627  /// Add the clang cc1 arguments for system include paths.
628  ///
629  /// This routine is responsible for adding the necessary cc1 arguments to
630  /// include headers from standard system header directories.
631  virtual void
632  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
633  llvm::opt::ArgStringList &CC1Args) const;
634 
635  /// Add options that need to be passed to cc1 for this target.
636  virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
637  llvm::opt::ArgStringList &CC1Args,
638  Action::OffloadKind DeviceOffloadKind) const;
639 
640  /// Add warning options that need to be passed to cc1 for this target.
641  virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
642 
643  // GetRuntimeLibType - Determine the runtime library type to use with the
644  // given compilation arguments.
645  virtual RuntimeLibType
646  GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
647 
648  // GetCXXStdlibType - Determine the C++ standard library type to use with the
649  // given compilation arguments.
650  virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
651 
652  // GetUnwindLibType - Determine the unwind library type to use with the
653  // given compilation arguments.
654  virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
655 
656  // Detect the highest available version of libc++ in include path.
657  virtual std::string detectLibcxxVersion(StringRef IncludePath) const;
658 
659  /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
660  /// the include paths to use for the given C++ standard library type.
661  virtual void
662  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
663  llvm::opt::ArgStringList &CC1Args) const;
664 
665  /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
666  /// the specified include paths for the C++ standard library.
667  void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
668  llvm::opt::ArgStringList &CC1Args) const;
669 
670  /// Returns if the C++ standard library should be linked in.
671  /// Note that e.g. -lm should still be linked even if this returns false.
672  bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
673 
674  /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
675  /// for the given C++ standard library type.
676  virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
677  llvm::opt::ArgStringList &CmdArgs) const;
678 
679  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
680  void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
681  llvm::opt::ArgStringList &CmdArgs) const;
682 
683  /// AddCCKextLibArgs - Add the system specific linker arguments to use
684  /// for kernel extensions (Darwin-specific).
685  virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
686  llvm::opt::ArgStringList &CmdArgs) const;
687 
688  /// If a runtime library exists that sets global flags for unsafe floating
689  /// point math, return true.
690  ///
691  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
692  virtual bool isFastMathRuntimeAvailable(
693  const llvm::opt::ArgList &Args, std::string &Path) const;
694 
695  /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
696  /// global flags for unsafe floating point math, add it and return true.
697  ///
698  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
700  const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
701 
702  /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
703  /// a suitable profile runtime library to the linker.
704  virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
705  llvm::opt::ArgStringList &CmdArgs) const;
706 
707  /// Add arguments to use system-specific CUDA includes.
708  virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
709  llvm::opt::ArgStringList &CC1Args) const;
710 
711  /// Add arguments to use system-specific HIP includes.
712  virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
713  llvm::opt::ArgStringList &CC1Args) const;
714 
715  /// Add arguments to use MCU GCC toolchain includes.
716  virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
717  llvm::opt::ArgStringList &CC1Args) const;
718 
719  /// On Windows, returns the MSVC compatibility version.
720  virtual VersionTuple computeMSVCVersion(const Driver *D,
721  const llvm::opt::ArgList &Args) const;
722 
723  /// Get paths for device libraries.
725  getDeviceLibs(const llvm::opt::ArgList &Args) const;
726 
727  /// Add the system specific linker arguments to use
728  /// for the given HIP runtime library type.
729  virtual void AddHIPRuntimeLibArgs(const llvm::opt::ArgList &Args,
730  llvm::opt::ArgStringList &CmdArgs) const {}
731 
732  /// Return sanitizers which are available in this toolchain.
733  virtual SanitizerMask getSupportedSanitizers() const;
734 
735  /// Return sanitizers which are enabled by default.
737  return SanitizerMask();
738  }
739 
740  /// Returns true when it's possible to split LTO unit to use whole
741  /// program devirtualization and CFI santiizers.
742  virtual bool canSplitThinLTOUnit() const { return true; }
743 
744  /// Returns the output denormal handling type in the default floating point
745  /// environment for the given \p FPType if given. Otherwise, the default
746  /// assumed mode for any floating point type.
747  virtual llvm::DenormalMode getDefaultDenormalModeForType(
748  const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
749  const llvm::fltSemantics *FPType = nullptr) const {
750  return llvm::DenormalMode::getIEEE();
751  }
752 
754  return llvm::None;
755  }
756 
757  // We want to expand the shortened versions of the triples passed in to
758  // the values used for the bitcode libraries.
759  static llvm::Triple getOpenMPTriple(StringRef TripleStr) {
760  llvm::Triple TT(TripleStr);
761  if (TT.getVendor() == llvm::Triple::UnknownVendor ||
762  TT.getOS() == llvm::Triple::UnknownOS) {
763  if (TT.getArch() == llvm::Triple::nvptx)
764  return llvm::Triple("nvptx-nvidia-cuda");
765  if (TT.getArch() == llvm::Triple::nvptx64)
766  return llvm::Triple("nvptx64-nvidia-cuda");
767  if (TT.getArch() == llvm::Triple::amdgcn)
768  return llvm::Triple("amdgcn-amd-amdhsa");
769  }
770  return TT;
771  }
772 };
773 
774 /// Set a ToolChain's effective triple. Reset it when the registration object
775 /// is destroyed.
777  const ToolChain &TC;
778 
779 public:
780  RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
781  TC.setEffectiveTriple(std::move(T));
782  }
783 
784  ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
785 };
786 
787 } // namespace driver
788 
789 } // namespace clang
790 
791 #endif // LLVM_CLANG_DRIVER_TOOLCHAIN_H
clang::driver::ToolChain::buildStaticLibTool
virtual Tool * buildStaticLibTool() const
Definition: ToolChain.cpp:315
clang::driver::ParsedClangName::ParsedClangName
ParsedClangName(std::string Suffix, const char *Mode)
Definition: ToolChain.h:78
clang::driver::ToolChain::getEffectiveTriple
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:262
clang::driver::ToolChain::UnwindTableLevel::Asynchronous
@ Asynchronous
clang::driver::ToolChain::GetDefaultDwarfVersion
virtual unsigned GetDefaultDwarfVersion() const
Definition: ToolChain.h:546
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::driver::ToolChain::getCompilerRT
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:510
clang::driver::ToolChain::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:99
clang::driver::ToolChain::getProgramPaths
path_list & getProgramPaths()
Definition: ToolChain.h:277
clang::driver::ParsedClangName
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:64
clang::LangOptions::StackProtectorMode
StackProtectorMode
Definition: LangOptions.h:84
clang::driver::ToolChain::hasBlocksRuntime
virtual bool hasBlocksRuntime() const
hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the...
Definition: ToolChain.h:621
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::ToolChain::getDefaultLinker
virtual const char * getDefaultLinker() const
GetDefaultLinker - Get the default linker to use.
Definition: ToolChain.h:456
clang::driver::ToolChain::getTargetAndModeFromProgramName
static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName)
Return any implicit target and/or mode flag for an invocation of the compiler driver as ProgName.
Definition: ToolChain.cpp:237
clang::driver::ToolChain::getDeviceLibs
virtual llvm::SmallVector< BitCodeLibraryInfo, 12 > getDeviceLibs(const llvm::opt::ArgList &Args) const
Get paths for device libraries.
Definition: ToolChain.cpp:1108
clang::driver::ToolChain::computeMSVCVersion
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1129
clang::driver::ToolChain::buildCompilerRTBasename
virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type, bool AddArch) const
Definition: ToolChain.cpp:476
clang::driver::ToolChain::getMultilib
const Multilib & getMultilib() const
Definition: ToolChain.h:282
clang::driver::ToolChain::getDefaultObjCRuntime
virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const
getDefaultObjCRuntime - Return the default Objective-C runtime for this platform.
Definition: ToolChain.cpp:723
clang::driver::MultilibSet
Definition: Multilib.h:114
clang::driver::ToolChain::path_list
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:93
clang::driver::ToolChain::TranslateXarchArgs
virtual void TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A, llvm::opt::DerivedArgList *DAL, SmallVectorImpl< llvm::opt::Arg * > *AllocatedArgs=nullptr) const
Append the argument following A to DAL assuming A is an Xarch argument.
Definition: ToolChain.cpp:1241
llvm::SmallVector< std::string, 16 >
clang::driver::ToolChain::UnwindTableLevel
UnwindTableLevel
Definition: ToolChain.h:111
clang::driver::ToolChain::GetDefaultStandaloneDebug
virtual bool GetDefaultStandaloneDebug() const
Definition: ToolChain.h:557
clang::driver::Action::ActionClass
ActionClass
Definition: Action.h:55
clang::driver::ToolChain::getRTTIArg
const llvm::opt::Arg * getRTTIArg() const
Definition: ToolChain.h:289
clang::driver::ToolChain::needsProfileRT
static bool needsProfileRT(const llvm::opt::ArgList &Args)
needsProfileRT - returns true if instrumentation profile is on.
Definition: ToolChain.cpp:575
clang::driver::ToolChain::GetProgramPath
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:608
clang::driver::ToolChain::parseInlineAsmUsingAsmParser
virtual bool parseInlineAsmUsingAsmParser() const
Check if the toolchain should use AsmParser to parse inlineAsm when integrated assembler is not defau...
Definition: ToolChain.h:419
clang::MultiVersionKind::Target
@ Target
clang::driver::ToolChain::AddClangCXXStdlibIncludeArgs
virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: ToolChain.cpp:980
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:55
clang::driver::ToolChain::getDefaultUniversalArchName
StringRef getDefaultUniversalArchName() const
Provide the default architecture name (as expected by -arch) for this toolchain.
Definition: ToolChain.cpp:261
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:232
clang::driver::ToolChain::detectLibcxxVersion
virtual std::string detectLibcxxVersion(StringRef IncludePath) const
Definition: ToolChain.cpp:957
clang::driver::ToolChain::FT_Object
@ FT_Object
Definition: ToolChain.h:129
clang::driver::ToolChain::getTripleString
std::string getTripleString() const
Definition: ToolChain.h:257
clang::driver::ToolChain::addFastMathRuntimeIfAvailable
bool addFastMathRuntimeIfAvailable(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFastMathRuntimeIfAvailable - If a runtime library exists that sets global flags for unsafe floatin...
Definition: ToolChain.cpp:1062
clang::driver::ToolChain::getCompilerRTPath
virtual std::string getCompilerRTPath() const
Definition: ToolChain.cpp:456
clang::driver::ToolChain::hasEffectiveTriple
bool hasEffectiveTriple() const
Definition: ToolChain.h:267
llvm::Optional< CXXStdlibType >
clang::driver::ToolChain::isPICDefault
virtual bool isPICDefault() const =0
Test whether this toolchain defaults to PIC.
clang::driver::ToolChain::HasNativeLLVMSupport
virtual bool HasNativeLLVMSupport() const
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: ToolChain.cpp:703
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:604
clang::codegenoptions::DebugInfoFormat
DebugInfoFormat
Definition: DebugInfoOptions.h:15
clang::driver::ToolChain::BitCodeLibraryInfo
Definition: ToolChain.h:122
clang::OffloadBundler
Definition: OffloadBundler.h:47
clang::driver::ToolChain::GetDefaultTrivialAutoVarInit
virtual LangOptions::TrivialAutoVarInitKind GetDefaultTrivialAutoVarInit() const
Get the default trivial automatic variable initialization.
Definition: ToolChain.h:451
clang::driver::ParsedClangName::ParsedClangName
ParsedClangName()=default
clang::driver::ToolChain::addClangWarningOptions
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:812
clang::driver::ToolChain::getArchName
StringRef getArchName() const
Definition: ToolChain.h:249
clang::driver::ToolChain::getMultilibs
const MultilibSet & getMultilibs() const
Definition: ToolChain.h:280
clang::driver::ToolChain::getSanitizerArgs
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:146
clang::driver::ToolChain::getInputFilename
virtual std::string getInputFilename(const InputInfo &Input) const
Some toolchains need to modify the file name, for example to replace the extension for object files w...
Definition: ToolChain.cpp:286
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::ToolChain::addExternCSystemIncludeIfExists
static void addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Definition: ToolChain.cpp:932
clang::driver::ToolChain::getThreadModel
virtual std::string getThreadModel() const
getThreadModel() - Which thread model does this target use?
Definition: ToolChain.h:581
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
clang::driver::ToolChain::useIntegratedBackend
virtual bool useIntegratedBackend() const
Check if the toolchain should use the integrated backend.
Definition: ToolChain.cpp:109
clang::driver::XRayArgs
Definition: XRayArgs.h:21
clang::driver::ToolChain::getDefaultDebuggerTuning
virtual llvm::DebuggerKind getDefaultDebuggerTuning() const
Definition: ToolChain.h:560
Action.h
clang::LangOptions::TrivialAutoVarInitKind
TrivialAutoVarInitKind
Definition: LangOptions.h:89
clang::LangOptions::SSPOff
@ SSPOff
Definition: LangOptions.h:84
clang::driver::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:274
clang::driver::ToolChain::isPIEDefault
virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const =0
Test whether this toolchain defaults to PIE.
clang::driver::ParsedClangName::DriverMode
const char * DriverMode
Corresponding driver mode argument, as '–driver-mode=g++'.
Definition: ToolChain.h:72
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::ToolChain::ToolChain
ToolChain(const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args)
Definition: ToolChain.cpp:75
clang::driver::ToolChain::concat
static std::string concat(StringRef Path, const Twine &A, const Twine &B="", const Twine &C="", const Twine &D="")
Definition: ToolChain.cpp:949
clang::driver::ParsedClangName::TargetIsValid
bool TargetIsValid
True if TargetPrefix is recognized as a registered target name.
Definition: ToolChain.h:75
clang::driver::ToolChain::getDefaultSanitizers
virtual SanitizerMask getDefaultSanitizers() const
Return sanitizers which are enabled by default.
Definition: ToolChain.h:736
clang::driver::ToolChain::getDefaultDebugFormat
virtual codegenoptions::DebugInfoFormat getDefaultDebugFormat() const
Get the default debug info format. Typically, this is DWARF.
Definition: ToolChain.h:533
clang::driver::ToolChain::isFastMathRuntimeAvailable
virtual bool isFastMathRuntimeAvailable(const llvm::opt::ArgList &Args, std::string &Path) const
If a runtime library exists that sets global flags for unsafe floating point math,...
Definition: ToolChain.cpp:1042
clang::driver::ToolChain::UseObjCMixedDispatch
virtual bool UseObjCMixedDispatch() const
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChain.h:434
clang::driver::ToolChain::IsObjCNonFragileABIDefault
virtual bool IsObjCNonFragileABIDefault() const
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChain.h:430
clang::driver::ToolChain::getOS
StringRef getOS() const
Definition: ToolChain.h:251
clang::driver::ToolChain::UNW_None
@ UNW_None
Definition: ToolChain.h:106
clang::driver::phases::Assemble
@ Assemble
Definition: Phases.h:22
clang::driver::phases::Link
@ Link
Definition: Phases.h:23
LangOptions.h
clang::driver::types::TY_INVALID
@ TY_INVALID
Definition: Types.h:24
clang::driver::ToolChain::AddClangSystemIncludeArgs
virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add the clang cc1 arguments for system include paths.
Definition: ToolChain.cpp:803
clang::driver::ToolChain::getMultiarchTriple
virtual std::string getMultiarchTriple(const Driver &D, const llvm::Triple &TargetTriple, StringRef SysRoot) const
Definition: ToolChain.h:589
clang::driver::ToolChain::RLT_Libgcc
@ RLT_Libgcc
Definition: ToolChain.h:102
clang::driver::ToolChain::AddCCKextLibArgs
virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCCKextLibArgs - Add the system specific linker arguments to use for kernel extensions (Darwin-spec...
Definition: ToolChain.cpp:1037
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
clang::driver::ToolChain::IsAArch64OutlineAtomicsDefault
virtual bool IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const
Test whether this toolchain supports outline atomics by default.
Definition: ToolChain.h:510
clang::driver::ToolChain::getProgramPaths
const path_list & getProgramPaths() const
Definition: ToolChain.h:278
clang::driver::ToolChain::BitCodeLibraryInfo::ShouldInternalize
bool ShouldInternalize
Definition: ToolChain.h:124
clang::driver::ToolChain::IsEncodeExtendedBlockSignatureDefault
virtual bool IsEncodeExtendedBlockSignatureDefault() const
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChain.h:426
clang::LangOptions::TrivialAutoVarInitKind::Uninitialized
@ Uninitialized
clang::driver::ToolChain::getTriple
const llvm::Triple & getTriple() const
Definition: ToolChain.h:234
clang::driver::ToolChain::SelectTool
virtual Tool * SelectTool(const JobAction &JA) const
Choose a tool to use to handle the action JA.
Definition: ToolChain.cpp:595
clang::driver::ToolChain::getRTTIMode
RTTIMode getRTTIMode() const
Definition: ToolChain.h:292
clang::driver::ToolChain::SelectedMultilib
Multilib SelectedMultilib
Definition: ToolChain.h:190
clang::driver::ToolChain::buildLinker
virtual Tool * buildLinker() const
Definition: ToolChain.cpp:311
clang::driver::ToolChain::GetGlobalDebugPathRemapping
virtual std::string GetGlobalDebugPathRemapping() const
Add an additional -fdebug-prefix-map entry.
Definition: ToolChain.h:542
clang::driver::ToolChain::UnwindTableLevel::Synchronous
@ Synchronous
clang::driver::ToolChain::getAuxTriple
virtual const llvm::Triple * getAuxTriple() const
Get the toolchain's aux triple, if it has one.
Definition: ToolChain.h:241
clang::driver::ToolChain::IsIntegratedAssemblerDefault
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:397
clang::driver::ToolChain::setTripleEnvironment
void setTripleEnvironment(llvm::Triple::EnvironmentType Env)
Definition: ToolChain.cpp:91
clang::driver::ToolChain::getStdlibPaths
path_list getStdlibPaths() const
Definition: ToolChain.cpp:559
clang::driver::Multilib
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Definition: Multilib.h:28
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
clang::driver::ToolChain::UNW_CompilerRT
@ UNW_CompilerRT
Definition: ToolChain.h:107
clang::driver::ToolChain::adjustDebugInfoKind
virtual void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const
Adjust debug information kind considering all passed options.
Definition: ToolChain.h:570
clang::driver::ToolChain::TranslateOpenMPTargetArgs
virtual llvm::opt::DerivedArgList * TranslateOpenMPTargetArgs(const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost, SmallVectorImpl< llvm::opt::Arg * > &AllocatedArgs) const
TranslateOpenMPTargetArgs - Create a new derived argument list for that contains the OpenMP target sp...
Definition: ToolChain.cpp:1169
clang::driver::SanitizerArgs
Definition: SanitizerArgs.h:24
clang::driver::ToolChain::UNW_Libgcc
@ UNW_Libgcc
Definition: ToolChain.h:108
clang::driver::ToolChain::CST_Libstdcxx
@ CST_Libstdcxx
Definition: ToolChain.h:97
clang::driver::ToolChain::GetExceptionModel
virtual llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const
GetExceptionModel - Return the tool chain exception model.
Definition: ToolChain.cpp:729
clang::driver::ToolChain::getDefaultUnwindTableLevel
virtual UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const
How detailed should the unwind tables be by default.
Definition: ToolChain.cpp:291
clang::driver::ToolChain::IsMathErrnoDefault
virtual bool IsMathErrnoDefault() const
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChain.h:422
clang::driver::ToolChain::getArch
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:248
clang::driver::ToolChain::AddFilePathLibArgs
void AddFilePathLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
Definition: ToolChain.cpp:1030
clang::driver::RegisterEffectiveTriple::~RegisterEffectiveTriple
~RegisterEffectiveTriple()
Definition: ToolChain.h:784
clang::driver::ToolChain::ShouldLinkCXXStdlib
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:1005
clang::driver::ParsedClangName::TargetPrefix
std::string TargetPrefix
Target part of the executable name, as i686-linux-android.
Definition: ToolChain.h:66
clang::driver::ToolChain::getRuntimePaths
path_list getRuntimePaths() const
Definition: ToolChain.cpp:537
clang::driver::ToolChain::IsBlocksDefault
virtual bool IsBlocksDefault() const
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChain.h:393
clang::driver::ToolChain::getCompilerRTBasename
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:469
clang::driver::ToolChain::FT_Static
@ FT_Static
Definition: ToolChain.h:129
clang::codegenoptions::DIF_DWARF
@ DIF_DWARF
Definition: DebugInfoOptions.h:16
clang::driver::ToolChain::printVerboseInfo
virtual void printVerboseInfo(raw_ostream &OS) const
Dispatch to the specific toolchain for verbose printing.
Definition: ToolChain.h:376
clang::driver::ParsedClangName::ParsedClangName
ParsedClangName(std::string Target, std::string Suffix, const char *Mode, bool IsRegistered)
Definition: ToolChain.h:80
clang::driver::ToolChain::GetUnwindLibType
virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:848
clang::driver::ToolChain::getPlatform
StringRef getPlatform() const
Definition: ToolChain.h:250
clang::driver::RegisterEffectiveTriple::RegisterEffectiveTriple
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
Definition: ToolChain.h:780
clang::driver::ToolChain::BitCodeLibraryInfo::Path
std::string Path
Definition: ToolChain.h:123
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1073
clang::driver::ToolChain::UnwindTableLevel::None
@ None
clang::driver::ToolChain::getTool
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:367
clang::driver::ToolChain::addSystemIncludes
static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, ArrayRef< StringRef > Paths)
Utility function to add a list of system include directories to CC1.
Definition: ToolChain.cpp:940
clang::driver::ToolChain::AddCXXStdlibLibArgs
virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
Definition: ToolChain.cpp:1011
clang::driver::ToolChain::getArchSpecificLibPath
std::string getArchSpecificLibPath() const
Definition: ToolChain.cpp:568
clang::driver::ToolChain::RM_Enabled
@ RM_Enabled
Definition: ToolChain.h:118
clang::driver::ToolChain::canSplitThinLTOUnit
virtual bool canSplitThinLTOUnit() const
Returns true when it's possible to split LTO unit to use whole program devirtualization and CFI santi...
Definition: ToolChain.h:742
UINT_MAX
#define UINT_MAX
Definition: limits.h:56
clang::driver::ToolChain::GetRuntimeLibType
virtual RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:822
clang::driver::ToolChain::addProfileRTLibs
virtual void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass a suitable profile runtime ...
Definition: ToolChain.cpp:814
clang::driver::ToolChain::isPICDefaultForced
virtual bool isPICDefaultForced() const =0
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
clang::driver::ToolChain::getCompilerRTArgString
const char * getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:531
clang::driver::ToolChain::getOpenMPTriple
static llvm::Triple getOpenMPTriple(StringRef TripleStr)
Definition: ToolChain.h:759
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::ToolChain::GetLinkerPath
std::string GetLinkerPath(bool *LinkerIsLLD=nullptr) const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name.
Definition: ToolChain.cpp:612
clang::driver::ToolChain::RLT_CompilerRT
@ RLT_CompilerRT
Definition: ToolChain.h:101
clang::driver::ToolChain::UseDwarfDebugFlags
virtual bool UseDwarfDebugFlags() const
UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information.
Definition: ToolChain.h:539
llvm::ArrayRef
Definition: LLVM.h:34
clang::driver::ToolChain::AddCudaIncludeArgs
virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific CUDA includes.
Definition: ToolChain.cpp:1101
clang::driver::ToolChain::LookupTypeForExtension
virtual types::ID LookupTypeForExtension(StringRef Ext) const
LookupTypeForExtension - Return the default language type to use for the given extension.
Definition: ToolChain.cpp:691
clang::driver::ToolChain::getDefaultDenormalModeForType
virtual llvm::DenormalMode getDefaultDenormalModeForType(const llvm::opt::ArgList &DriverArgs, const JobAction &JA, const llvm::fltSemantics *FPType=nullptr) const
Returns the output denormal handling type in the default floating point environment for the given FPT...
Definition: ToolChain.h:747
clang::driver::ToolChain::useIntegratedAs
virtual bool useIntegratedAs() const
Check if the toolchain should use the integrated assembler.
Definition: ToolChain.cpp:103
clang::driver::ToolChain::AddClangCXXStdlibIsystemArgs
void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set the specified include paths ...
Definition: ToolChain.cpp:994
clang::driver::ToolChain::computeSysRoot
virtual std::string computeSysRoot() const
Return the sysroot, possibly searching for a default sysroot using target-specific logic.
Definition: ToolChain.cpp:799
clang::driver::ToolChain::ComputeLLVMTriple
virtual std::string ComputeLLVMTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeLLVMTriple - Return the LLVM target triple to use, after taking command line arguments into ac...
Definition: ToolChain.cpp:746
LLVM.h
clang::driver::ToolChain::SupportsEmbeddedBitcode
virtual bool SupportsEmbeddedBitcode() const
SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
Definition: ToolChain.h:578
clang::driver::ToolChain::getLibraryPaths
path_list & getLibraryPaths()
Definition: ToolChain.h:271
clang::driver::phases::IfsMerge
@ IfsMerge
Definition: Phases.h:24
clang::driver::ToolChain::IsNonIntegratedBackendSupported
virtual bool IsNonIntegratedBackendSupported() const
IsNonIntegratedBackendSupported - Does this tool chain support -fno-integrated-objemitter.
Definition: ToolChain.h:409
clang::driver::ToolChain::isBareMetal
virtual bool isBareMetal() const
isBareMetal - Is this a bare metal target.
Definition: ToolChain.h:587
clang::driver::ToolChain::getMaxDwarfVersion
virtual unsigned getMaxDwarfVersion() const
Definition: ToolChain.h:551
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::ToolChain::BitCodeLibraryInfo::BitCodeLibraryInfo
BitCodeLibraryInfo(StringRef Path, bool ShouldInternalize=true)
Definition: ToolChain.h:125
clang::ObjCRuntime
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
clang::driver::ToolChain::getOSLibName
virtual StringRef getOSLibName() const
Definition: ToolChain.cpp:436
clang::driver::ToolChain::IsIntegratedBackendSupported
virtual bool IsIntegratedBackendSupported() const
IsIntegratedBackendSupported - Does this tool chain support -fintegrated-objemitter.
Definition: ToolChain.h:405
clang::driver::ToolChain::FileType
FileType
Definition: ToolChain.h:129
clang::driver::ToolChain::GetDefaultCXXStdlibType
virtual CXXStdlibType GetDefaultCXXStdlibType() const
Definition: ToolChain.h:463
clang::driver::ToolChain::GetCXXStdlibType
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:884
clang::driver::ToolChain::AddIAMCUIncludeArgs
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1112
clang::driver::ToolChain::GetDefaultUnwindLibType
virtual UnwindLibType GetDefaultUnwindLibType() const
Definition: ToolChain.h:467
Sanitizers.h
clang::driver::ToolChain::isThreadModelSupported
virtual bool isThreadModelSupported(const StringRef Model) const
isThreadModelSupported() - Does this target support a thread model?
Definition: ToolChain.cpp:733
clang::driver::ToolChain::CheckObjCARC
virtual void CheckObjCARC() const
Complain if this tool chain doesn't support Objective-C ARC.
Definition: ToolChain.h:530
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:72
clang::driver::ToolChain::AddHIPRuntimeLibArgs
virtual void AddHIPRuntimeLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Add the system specific linker arguments to use for the given HIP runtime library type.
Definition: ToolChain.h:729
DebugInfoOptions.h
clang::driver::ToolChain::TranslateArgs
virtual llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch, Action::OffloadKind DeviceOffloadKind) const
TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may w...
Definition: ToolChain.h:321
clang::driver::ToolChain::getFilePaths
const path_list & getFilePaths() const
Definition: ToolChain.h:275
clang::driver::ToolChain::getLibraryPaths
const path_list & getLibraryPaths() const
Definition: ToolChain.h:272
clang::driver::ToolChain::Multilibs
MultilibSet Multilibs
Definition: ToolChain.h:189
clang::driver::ToolChain::defaultToIEEELongDouble
bool defaultToIEEELongDouble() const
Check whether use IEEE binary128 as long double format by default.
Definition: ToolChain.cpp:141
Multilib.h
clang::driver::ToolChain::UnwindLibType
UnwindLibType
Definition: ToolChain.h:105
clang::driver::ToolChain::AddHIPIncludeArgs
virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific HIP includes.
Definition: ToolChain.cpp:1104
clang::codegenoptions::DebugInfoKind
DebugInfoKind
Definition: DebugInfoOptions.h:20
Types.h
clang::driver::ParsedClangName::isEmpty
bool isEmpty() const
Definition: ToolChain.h:85
clang::driver::ToolChain::addExternCSystemInclude
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory with extern "C" semantics to CC1 arguments.
Definition: ToolChain.cpp:925
clang::driver::RegisterEffectiveTriple
Set a ToolChain's effective triple.
Definition: ToolChain.h:776
clang::driver::ToolChain::needsGCovInstrumentation
static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args)
Returns true if gcov instrumentation (-fprofile-arcs or –coverage) is on.
Definition: ToolChain.cpp:589
clang::driver::ToolChain::addClangTargetOptions
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:808
clang::driver::ToolChain::isCrossCompiling
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChain.cpp:707
clang::driver::ToolChain::RTTIMode
RTTIMode
Definition: ToolChain.h:117
clang::driver::ToolChain::getXRayArgs
const XRayArgs & getXRayArgs() const
Definition: ToolChain.cpp:152
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:87
clang::driver::ToolChain::useRelaxRelocations
virtual bool useRelaxRelocations() const
Check whether to enable x86 relax relocations by default.
Definition: ToolChain.cpp:137
clang::driver::ToolChain::~ToolChain
virtual ~ToolChain()
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::driver::ToolChain::addSystemInclude
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory to CC1 arguments.
Definition: ToolChain.cpp:910
clang::driver::ToolChain::supportsDebugInfoOption
virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const
Does this toolchain supports given debug info option or not.
Definition: ToolChain.h:565
clang::driver::ToolChain::getTargetVariantTriple
virtual Optional< llvm::Triple > getTargetVariantTriple() const
Definition: ToolChain.h:753
clang::driver::ToolChain::FT_Shared
@ FT_Shared
Definition: ToolChain.h:129
clang::driver::JobAction
Definition: Action.h:399
clang::driver::ToolChain::GetDefaultStackProtectorLevel
virtual LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: ToolChain.h:445
clang::driver::ParsedClangName::ModeSuffix
std::string ModeSuffix
Driver mode part of the executable name, as g++.
Definition: ToolChain.h:69
clang::driver::ToolChain::SupportsProfiling
virtual bool SupportsProfiling() const
SupportsProfiling - Does this tool chain support -pg.
Definition: ToolChain.h:527
clang::driver::ToolChain::GetDefaultRuntimeLibType
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:459
clang::driver::ToolChain::buildAssembler
virtual Tool * buildAssembler() const
Definition: ToolChain.cpp:307
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::driver::ToolChain::IsIntegratedBackendDefault
virtual bool IsIntegratedBackendDefault() const
IsIntegratedBackendDefault - Does this tool chain enable -fintegrated-objemitter by default.
Definition: ToolChain.h:401
clang::driver::ToolChain::GetStaticLibToolPath
std::string GetStaticLibToolPath() const
Returns the linker path for emitting a static library.
Definition: ToolChain.cpp:684
clang::driver::ToolChain::ComputeEffectiveClangTriple
virtual std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into acc...
Definition: ToolChain.cpp:794
clang::driver::ToolChain::RM_Disabled
@ RM_Disabled
Definition: ToolChain.h:119