clang  14.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 RTTIMode {
114  };
115 
119  BitCodeLibraryInfo(StringRef Path, bool ShouldInternalize = true)
121  };
122 
124 
125 private:
127 
128  const Driver &D;
129  llvm::Triple Triple;
130  const llvm::opt::ArgList &Args;
131 
132  // We need to initialize CachedRTTIArg before CachedRTTIMode
133  const llvm::opt::Arg *const CachedRTTIArg;
134 
135  const RTTIMode CachedRTTIMode;
136 
137  /// The list of toolchain specific path prefixes to search for libraries.
138  path_list LibraryPaths;
139 
140  /// The list of toolchain specific path prefixes to search for files.
141  path_list FilePaths;
142 
143  /// The list of toolchain specific path prefixes to search for programs.
144  path_list ProgramPaths;
145 
146  mutable std::unique_ptr<Tool> Clang;
147  mutable std::unique_ptr<Tool> Flang;
148  mutable std::unique_ptr<Tool> Assemble;
149  mutable std::unique_ptr<Tool> Link;
150  mutable std::unique_ptr<Tool> StaticLibTool;
151  mutable std::unique_ptr<Tool> IfsMerge;
152  mutable std::unique_ptr<Tool> OffloadBundler;
153  mutable std::unique_ptr<Tool> OffloadWrapper;
154 
155  Tool *getClang() const;
156  Tool *getFlang() const;
157  Tool *getAssemble() const;
158  Tool *getLink() const;
159  Tool *getStaticLibTool() const;
160  Tool *getIfsMerge() const;
161  Tool *getClangAs() const;
162  Tool *getOffloadBundler() const;
163  Tool *getOffloadWrapper() const;
164 
165  mutable bool SanitizerArgsChecked = false;
166  mutable std::unique_ptr<XRayArgs> XRayArguments;
167 
168  /// The effective clang triple for the current Job.
169  mutable llvm::Triple EffectiveTriple;
170 
171  /// Set the toolchain's effective clang triple.
172  void setEffectiveTriple(llvm::Triple ET) const {
173  EffectiveTriple = std::move(ET);
174  }
175 
176  mutable llvm::Optional<CXXStdlibType> cxxStdlibType;
177  mutable llvm::Optional<RuntimeLibType> runtimeLibType;
178  mutable llvm::Optional<UnwindLibType> unwindLibType;
179 
180 protected:
183 
184  ToolChain(const Driver &D, const llvm::Triple &T,
185  const llvm::opt::ArgList &Args);
186 
187  void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
188 
189  virtual Tool *buildAssembler() const;
190  virtual Tool *buildLinker() const;
191  virtual Tool *buildStaticLibTool() const;
192  virtual Tool *getTool(Action::ActionClass AC) const;
193 
194  virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args,
195  StringRef Component,
196  FileType Type,
197  bool AddArch) const;
198 
199  /// \name Utilities for implementing subclasses.
200  ///@{
201  static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
202  llvm::opt::ArgStringList &CC1Args,
203  const Twine &Path);
204  static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
205  llvm::opt::ArgStringList &CC1Args,
206  const Twine &Path);
207  static void
208  addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
209  llvm::opt::ArgStringList &CC1Args,
210  const Twine &Path);
211  static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
212  llvm::opt::ArgStringList &CC1Args,
213  ArrayRef<StringRef> Paths);
214  ///@}
215 
216 public:
217  virtual ~ToolChain();
218 
219  // Accessors
220 
221  const Driver &getDriver() const { return D; }
222  llvm::vfs::FileSystem &getVFS() const;
223  const llvm::Triple &getTriple() const { return Triple; }
224 
225  /// Get the toolchain's aux triple, if it has one.
226  ///
227  /// Exactly what the aux triple represents depends on the toolchain, but for
228  /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
229  /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
230  virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
231 
232  /// Some toolchains need to modify the file name, for example to replace the
233  /// extension for object files with .cubin for OpenMP offloading to Nvidia
234  /// GPUs.
235  virtual std::string getInputFilename(const InputInfo &Input) const;
236 
237  llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
238  StringRef getArchName() const { return Triple.getArchName(); }
239  StringRef getPlatform() const { return Triple.getVendorName(); }
240  StringRef getOS() const { return Triple.getOSName(); }
241 
242  /// Provide the default architecture name (as expected by -arch) for
243  /// this toolchain.
244  StringRef getDefaultUniversalArchName() const;
245 
247  return Triple.getTriple();
248  }
249 
250  /// Get the toolchain's effective clang triple.
251  const llvm::Triple &getEffectiveTriple() const {
252  assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
253  return EffectiveTriple;
254  }
255 
256  path_list &getLibraryPaths() { return LibraryPaths; }
257  const path_list &getLibraryPaths() const { return LibraryPaths; }
258 
259  path_list &getFilePaths() { return FilePaths; }
260  const path_list &getFilePaths() const { return FilePaths; }
261 
262  path_list &getProgramPaths() { return ProgramPaths; }
263  const path_list &getProgramPaths() const { return ProgramPaths; }
264 
265  const MultilibSet &getMultilibs() const { return Multilibs; }
266 
267  const Multilib &getMultilib() const { return SelectedMultilib; }
268 
269  SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const;
270 
271  const XRayArgs& getXRayArgs() const;
272 
273  // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
274  const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
275 
276  // Returns the RTTIMode for the toolchain with the current arguments.
277  RTTIMode getRTTIMode() const { return CachedRTTIMode; }
278 
279  /// Return any implicit target and/or mode flag for an invocation of
280  /// the compiler driver as `ProgName`.
281  ///
282  /// For example, when called with i686-linux-android-g++, the first element
283  /// of the return value will be set to `"i686-linux-android"` and the second
284  /// will be set to "--driver-mode=g++"`.
285  /// It is OK if the target name is not registered. In this case the return
286  /// value contains false in the field TargetIsValid.
287  ///
288  /// \pre `llvm::InitializeAllTargets()` has been called.
289  /// \param ProgName The name the Clang driver was invoked with (from,
290  /// e.g., argv[0]).
291  /// \return A structure of type ParsedClangName that contains the executable
292  /// name parts.
293  static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName);
294 
295  // Tool access.
296 
297  /// TranslateArgs - Create a new derived argument list for any argument
298  /// translations this ToolChain may wish to perform, or 0 if no tool chain
299  /// specific translations are needed. If \p DeviceOffloadKind is specified
300  /// the translation specific for that offload kind is performed.
301  ///
302  /// \param BoundArch - The bound architecture name, or 0.
303  /// \param DeviceOffloadKind - The device offload kind used for the
304  /// translation.
305  virtual llvm::opt::DerivedArgList *
306  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
307  Action::OffloadKind DeviceOffloadKind) const {
308  return nullptr;
309  }
310 
311  /// TranslateOpenMPTargetArgs - Create a new derived argument list for
312  /// that contains the OpenMP target specific flags passed via
313  /// -Xopenmp-target -opt=val OR -Xopenmp-target=<triple> -opt=val
314  virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
315  const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
316  SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
317 
318  /// Append the argument following \p A to \p DAL assuming \p A is an Xarch
319  /// argument. If \p AllocatedArgs is null pointer, synthesized arguments are
320  /// added to \p DAL, otherwise they are appended to \p AllocatedArgs.
321  virtual void TranslateXarchArgs(
322  const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
323  llvm::opt::DerivedArgList *DAL,
324  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs = nullptr) const;
325 
326  /// Translate -Xarch_ arguments. If there are no such arguments, return
327  /// a null pointer, otherwise return a DerivedArgList containing the
328  /// translated arguments.
329  virtual llvm::opt::DerivedArgList *
330  TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
331  Action::OffloadKind DeviceOffloadKind,
332  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const;
333 
334  /// Choose a tool to use to handle the action \p JA.
335  ///
336  /// This can be overridden when a particular ToolChain needs to use
337  /// a compiler other than Clang.
338  virtual Tool *SelectTool(const JobAction &JA) const;
339 
340  // Helper methods
341 
342  std::string GetFilePath(const char *Name) const;
343  std::string GetProgramPath(const char *Name) const;
344 
345  /// Returns the linker path, respecting the -fuse-ld= argument to determine
346  /// the linker suffix or name.
347  /// If LinkerIsLLD is non-nullptr, it is set to true if the returned linker
348  /// is LLD. If it's set, it can be assumed that the linker is LLD built
349  /// at the same revision as clang, and clang can make assumptions about
350  /// LLD's supported flags, error output, etc.
351  std::string GetLinkerPath(bool *LinkerIsLLD = nullptr) const;
352 
353  /// Returns the linker path for emitting a static library.
355 
356  /// Dispatch to the specific toolchain for verbose printing.
357  ///
358  /// This is used when handling the verbose option to print detailed,
359  /// toolchain-specific information useful for understanding the behavior of
360  /// the driver on a specific platform.
361  virtual void printVerboseInfo(raw_ostream &OS) const {}
362 
363  // Platform defaults information
364 
365  /// Returns true if the toolchain is targeting a non-native
366  /// architecture.
367  virtual bool isCrossCompiling() const;
368 
369  /// HasNativeLTOLinker - Check whether the linker and related tools have
370  /// native LLVM support.
371  virtual bool HasNativeLLVMSupport() const;
372 
373  /// LookupTypeForExtension - Return the default language type to use for the
374  /// given extension.
375  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
376 
377  /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
378  virtual bool IsBlocksDefault() const { return false; }
379 
380  /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
381  /// by default.
382  virtual bool IsIntegratedAssemblerDefault() const { return false; }
383 
384  /// Check if the toolchain should use the integrated assembler.
385  virtual bool useIntegratedAs() const;
386 
387  /// Check if the toolchain should use the integrated backend.
388  virtual bool useIntegratedBackend() const { return true; }
389 
390  /// Check if the toolchain should use AsmParser to parse inlineAsm when
391  /// integrated assembler is not default.
392  virtual bool parseInlineAsmUsingAsmParser() const { return false; }
393 
394  /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
395  virtual bool IsMathErrnoDefault() const { return true; }
396 
397  /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
398  /// -fencode-extended-block-signature by default.
399  virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
400 
401  /// IsObjCNonFragileABIDefault - Does this tool chain set
402  /// -fobjc-nonfragile-abi by default.
403  virtual bool IsObjCNonFragileABIDefault() const { return false; }
404 
405  /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
406  /// mixed dispatch method be used?
407  virtual bool UseObjCMixedDispatch() const { return false; }
408 
409  /// Check whether to enable x86 relax relocations by default.
410  virtual bool useRelaxRelocations() const;
411 
412  /// GetDefaultStackProtectorLevel - Get the default stack protector level for
413  /// this tool chain.
415  GetDefaultStackProtectorLevel(bool KernelOrKext) const {
416  return LangOptions::SSPOff;
417  }
418 
419  /// Get the default trivial automatic variable initialization.
423  }
424 
425  /// GetDefaultLinker - Get the default linker to use.
426  virtual const char *getDefaultLinker() const { return "ld"; }
427 
428  /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
430  return ToolChain::RLT_Libgcc;
431  }
432 
435  }
436 
438  return ToolChain::UNW_None;
439  }
440 
441  virtual std::string getCompilerRTPath() const;
442 
443  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
444  StringRef Component,
446 
447  const char *
448  getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
450 
451  std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
452  StringRef Component,
454 
455  // Returns target specific runtime paths.
456  path_list getRuntimePaths() const;
457 
458  // Returns target specific standard library paths.
459  path_list getStdlibPaths() const;
460 
461  // Returns <ResourceDir>/lib/<OSName>/<arch>. This is used by runtimes (such
462  // as OpenMP) to find arch-specific libraries.
464 
465  // Returns <OSname> part of above.
466  virtual StringRef getOSLibName() const;
467 
468  /// needsProfileRT - returns true if instrumentation profile is on.
469  static bool needsProfileRT(const llvm::opt::ArgList &Args);
470 
471  /// Returns true if gcov instrumentation (-fprofile-arcs or --coverage) is on.
472  static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args);
473 
474  /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
475  /// by default.
476  virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const;
477 
478  /// Test whether this toolchain supports outline atomics by default.
479  virtual bool
480  IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const {
481  return false;
482  }
483 
484  /// Test whether this toolchain defaults to PIC.
485  virtual bool isPICDefault() const = 0;
486 
487  /// Test whether this toolchain defaults to PIE.
488  virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const = 0;
489 
490  /// Tests whether this toolchain forces its default for PIC, PIE or
491  /// non-PIC. If this returns true, any PIC related flags should be ignored
492  /// and instead the results of \c isPICDefault() and \c isPIEDefault(const
493  /// llvm::opt::ArgList &Args) are used exclusively.
494  virtual bool isPICDefaultForced() const = 0;
495 
496  /// SupportsProfiling - Does this tool chain support -pg.
497  virtual bool SupportsProfiling() const { return true; }
498 
499  /// Complain if this tool chain doesn't support Objective-C ARC.
500  virtual void CheckObjCARC() const {}
501 
502  /// Get the default debug info format. Typically, this is DWARF.
505  }
506 
507  /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
508  /// compile unit information.
509  virtual bool UseDwarfDebugFlags() const { return false; }
510 
511  // Return the DWARF version to emit, in the absence of arguments
512  // to the contrary.
513  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
514 
515  // Some toolchains may have different restrictions on the DWARF version and
516  // may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
517  // compilation uses DWARF5.
518  virtual unsigned getMaxDwarfVersion() const { return UINT_MAX; }
519 
520  // True if the driver should assume "-fstandalone-debug"
521  // in the absence of an option specifying otherwise,
522  // provided that debugging was requested in the first place.
523  // i.e. a value of 'true' does not imply that debugging is wanted.
524  virtual bool GetDefaultStandaloneDebug() const { return false; }
525 
526  // Return the default debugger "tuning."
527  virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
528  return llvm::DebuggerKind::GDB;
529  }
530 
531  /// Does this toolchain supports given debug info option or not.
532  virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
533  return true;
534  }
535 
536  /// Adjust debug information kind considering all passed options.
538  const llvm::opt::ArgList &Args) const {}
539 
540  /// GetExceptionModel - Return the tool chain exception model.
541  virtual llvm::ExceptionHandling
542  GetExceptionModel(const llvm::opt::ArgList &Args) const;
543 
544  /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
545  virtual bool SupportsEmbeddedBitcode() const { return false; }
546 
547  /// getThreadModel() - Which thread model does this target use?
548  virtual std::string getThreadModel() const { return "posix"; }
549 
550  /// isThreadModelSupported() - Does this target support a thread model?
551  virtual bool isThreadModelSupported(const StringRef Model) const;
552 
554  const llvm::Triple &TargetTriple,
555  StringRef SysRoot) const {
556  return TargetTriple.str();
557  }
558 
559  /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
560  /// command line arguments into account.
561  virtual std::string
562  ComputeLLVMTriple(const llvm::opt::ArgList &Args,
563  types::ID InputType = types::TY_INVALID) const;
564 
565  /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
566  /// target, which may take into account the command line arguments. For
567  /// example, on Darwin the -mmacosx-version-min= command line argument (which
568  /// sets the deployment target) determines the version in the triple passed to
569  /// Clang.
571  const llvm::opt::ArgList &Args,
572  types::ID InputType = types::TY_INVALID) const;
573 
574  /// getDefaultObjCRuntime - Return the default Objective-C runtime
575  /// for this platform.
576  ///
577  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
578  virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
579 
580  /// hasBlocksRuntime - Given that the user is compiling with
581  /// -fblocks, does this tool chain guarantee the existence of a
582  /// blocks runtime?
583  ///
584  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
585  virtual bool hasBlocksRuntime() const { return true; }
586 
587  /// Return the sysroot, possibly searching for a default sysroot using
588  /// target-specific logic.
589  virtual std::string computeSysRoot() const;
590 
591  /// Add the clang cc1 arguments for system include paths.
592  ///
593  /// This routine is responsible for adding the necessary cc1 arguments to
594  /// include headers from standard system header directories.
595  virtual void
596  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
597  llvm::opt::ArgStringList &CC1Args) const;
598 
599  /// Add options that need to be passed to cc1 for this target.
600  virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
601  llvm::opt::ArgStringList &CC1Args,
602  Action::OffloadKind DeviceOffloadKind) const;
603 
604  /// Add warning options that need to be passed to cc1 for this target.
605  virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
606 
607  // GetRuntimeLibType - Determine the runtime library type to use with the
608  // given compilation arguments.
609  virtual RuntimeLibType
610  GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
611 
612  // GetCXXStdlibType - Determine the C++ standard library type to use with the
613  // given compilation arguments.
614  virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
615 
616  // GetUnwindLibType - Determine the unwind library type to use with the
617  // given compilation arguments.
618  virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
619 
620  // Detect the highest available version of libc++ in include path.
621  virtual std::string detectLibcxxVersion(StringRef IncludePath) const;
622 
623  /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
624  /// the include paths to use for the given C++ standard library type.
625  virtual void
626  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
627  llvm::opt::ArgStringList &CC1Args) const;
628 
629  /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
630  /// the specified include paths for the C++ standard library.
631  void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
632  llvm::opt::ArgStringList &CC1Args) const;
633 
634  /// Returns if the C++ standard library should be linked in.
635  /// Note that e.g. -lm should still be linked even if this returns false.
636  bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
637 
638  /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
639  /// for the given C++ standard library type.
640  virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
641  llvm::opt::ArgStringList &CmdArgs) const;
642 
643  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
644  void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
645  llvm::opt::ArgStringList &CmdArgs) const;
646 
647  /// AddCCKextLibArgs - Add the system specific linker arguments to use
648  /// for kernel extensions (Darwin-specific).
649  virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
650  llvm::opt::ArgStringList &CmdArgs) const;
651 
652  /// If a runtime library exists that sets global flags for unsafe floating
653  /// point math, return true.
654  ///
655  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
656  virtual bool isFastMathRuntimeAvailable(
657  const llvm::opt::ArgList &Args, std::string &Path) const;
658 
659  /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
660  /// global flags for unsafe floating point math, add it and return true.
661  ///
662  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
664  const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
665 
666  /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
667  /// a suitable profile runtime library to the linker.
668  virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
669  llvm::opt::ArgStringList &CmdArgs) const;
670 
671  /// Add arguments to use system-specific CUDA includes.
672  virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
673  llvm::opt::ArgStringList &CC1Args) const;
674 
675  /// Add arguments to use system-specific HIP includes.
676  virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
677  llvm::opt::ArgStringList &CC1Args) const;
678 
679  /// Add arguments to use MCU GCC toolchain includes.
680  virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
681  llvm::opt::ArgStringList &CC1Args) const;
682 
683  /// On Windows, returns the MSVC compatibility version.
684  virtual VersionTuple computeMSVCVersion(const Driver *D,
685  const llvm::opt::ArgList &Args) const;
686 
687  /// Get paths of HIP device libraries.
689  getHIPDeviceLibs(const llvm::opt::ArgList &Args) const;
690 
691  /// Return sanitizers which are available in this toolchain.
692  virtual SanitizerMask getSupportedSanitizers() const;
693 
694  /// Return sanitizers which are enabled by default.
696  return SanitizerMask();
697  }
698 
699  /// Returns true when it's possible to split LTO unit to use whole
700  /// program devirtualization and CFI santiizers.
701  virtual bool canSplitThinLTOUnit() const { return true; }
702 
703  /// Returns the output denormal handling type in the default floating point
704  /// environment for the given \p FPType if given. Otherwise, the default
705  /// assumed mode for any floating point type.
706  virtual llvm::DenormalMode getDefaultDenormalModeForType(
707  const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
708  const llvm::fltSemantics *FPType = nullptr) const {
709  return llvm::DenormalMode::getIEEE();
710  }
711 };
712 
713 /// Set a ToolChain's effective triple. Reset it when the registration object
714 /// is destroyed.
716  const ToolChain &TC;
717 
718 public:
719  RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
720  TC.setEffectiveTriple(std::move(T));
721  }
722 
723  ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
724 };
725 
726 } // namespace driver
727 
728 } // namespace clang
729 
730 #endif // LLVM_CLANG_DRIVER_TOOLCHAIN_H
clang::driver::ToolChain::buildStaticLibTool
virtual Tool * buildStaticLibTool() const
Definition: ToolChain.cpp:280
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:251
clang::driver::ToolChain::GetDefaultDwarfVersion
virtual unsigned GetDefaultDwarfVersion() const
Definition: ToolChain.h:513
llvm
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:460
clang::driver::ToolChain::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:98
clang::driver::ToolChain::getProgramPaths
path_list & getProgramPaths()
Definition: ToolChain.h:262
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:64
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:585
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:426
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:203
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:1061
clang::driver::ToolChain::buildCompilerRTBasename
virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type, bool AddArch) const
Definition: ToolChain.cpp:426
clang::driver::ToolChain::getMultilib
const Multilib & getMultilib() const
Definition: ToolChain.h:267
clang::driver::ToolChain::getDefaultObjCRuntime
virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const
getDefaultObjCRuntime - Return the default Objective-C runtime for this platform.
Definition: ToolChain.cpp:668
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:1171
llvm::SmallVector< std::string, 16 >
clang::driver::ToolChain::GetDefaultStandaloneDebug
virtual bool GetDefaultStandaloneDebug() const
Definition: ToolChain.h:524
clang::driver::Action::ActionClass
ActionClass
Definition: Action.h:55
clang::driver::ToolChain::getRTTIArg
const llvm::opt::Arg * getRTTIArg() const
Definition: ToolChain.h:274
clang::driver::ToolChain::needsProfileRT
static bool needsProfileRT(const llvm::opt::ArgList &Args)
needsProfileRT - returns true if instrumentation profile is on.
Definition: ToolChain.cpp:525
clang::driver::ToolChain::GetProgramPath
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:558
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:392
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:917
clang::driver::ToolChain::getDefaultUniversalArchName
StringRef getDefaultUniversalArchName() const
Provide the default architecture name (as expected by -arch) for this toolchain.
Definition: ToolChain.cpp:227
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:221
clang::driver::ToolChain::detectLibcxxVersion
virtual std::string detectLibcxxVersion(StringRef IncludePath) const
Definition: ToolChain.cpp:894
clang::driver::ToolChain::FT_Object
@ FT_Object
Definition: ToolChain.h:123
clang::driver::ToolChain::getTripleString
std::string getTripleString() const
Definition: ToolChain.h:246
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:997
clang::driver::ToolChain::getCompilerRTPath
virtual std::string getCompilerRTPath() const
Definition: ToolChain.cpp:409
llvm::Optional< CXXStdlibType >
clang::driver::ToolChain::useIntegratedBackend
virtual bool useIntegratedBackend() const
Check if the toolchain should use the integrated backend.
Definition: ToolChain.h:388
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:648
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:554
clang::codegenoptions::DebugInfoFormat
DebugInfoFormat
Definition: DebugInfoOptions.h:15
clang::driver::ToolChain::BitCodeLibraryInfo
Definition: ToolChain.h:116
clang::driver::ToolChain::GetDefaultTrivialAutoVarInit
virtual LangOptions::TrivialAutoVarInitKind GetDefaultTrivialAutoVarInit() const
Get the default trivial automatic variable initialization.
Definition: ToolChain.h:421
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:757
clang::driver::ToolChain::getArchName
StringRef getArchName() const
Definition: ToolChain.h:238
clang::driver::ToolChain::getMultilibs
const MultilibSet & getMultilibs() const
Definition: ToolChain.h:265
clang::driver::ToolChain::getSanitizerArgs
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:113
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:252
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:877
clang::driver::ToolChain::getThreadModel
virtual std::string getThreadModel() const
getThreadModel() - Which thread model does this target use?
Definition: ToolChain.h:548
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1491
clang::driver::XRayArgs
Definition: XRayArgs.h:21
clang::driver::ToolChain::getDefaultDebuggerTuning
virtual llvm::DebuggerKind getDefaultDebuggerTuning() const
Definition: ToolChain.h:527
Action.h
clang::LangOptions::TrivialAutoVarInitKind
TrivialAutoVarInitKind
Definition: LangOptions.h:69
clang::LangOptions::SSPOff
@ SSPOff
Definition: LangOptions.h:64
clang::driver::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:259
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:74
clang::driver::ToolChain::getHIPDeviceLibs
virtual llvm::SmallVector< BitCodeLibraryInfo, 12 > getHIPDeviceLibs(const llvm::opt::ArgList &Args) const
Get paths of HIP device libraries.
Definition: ToolChain.cpp:1040
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:695
clang::driver::ToolChain::getDefaultDebugFormat
virtual codegenoptions::DebugInfoFormat getDefaultDebugFormat() const
Get the default debug info format. Typically, this is DWARF.
Definition: ToolChain.h:503
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:977
clang::driver::ToolChain::UseObjCMixedDispatch
virtual bool UseObjCMixedDispatch() const
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChain.h:407
clang::driver::ToolChain::IsObjCNonFragileABIDefault
virtual bool IsObjCNonFragileABIDefault() const
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChain.h:403
clang::driver::ToolChain::getOS
StringRef getOS() const
Definition: ToolChain.h:240
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
clang::driver::ToolChain::IsUnwindTablesDefault
virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: ToolChain.cpp:256
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:748
clang::driver::ToolChain::getMultiarchTriple
virtual std::string getMultiarchTriple(const Driver &D, const llvm::Triple &TargetTriple, StringRef SysRoot) const
Definition: ToolChain.h:553
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:972
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:480
clang::driver::ToolChain::getProgramPaths
const path_list & getProgramPaths() const
Definition: ToolChain.h:263
clang::driver::ToolChain::BitCodeLibraryInfo::ShouldInternalize
bool ShouldInternalize
Definition: ToolChain.h:118
clang::driver::ToolChain::IsEncodeExtendedBlockSignatureDefault
virtual bool IsEncodeExtendedBlockSignatureDefault() const
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChain.h:399
clang::LangOptions::TrivialAutoVarInitKind::Uninitialized
@ Uninitialized
clang::driver::ToolChain::getTriple
const llvm::Triple & getTriple() const
Definition: ToolChain.h:223
clang::driver::ToolChain::SelectTool
virtual Tool * SelectTool(const JobAction &JA) const
Choose a tool to use to handle the action JA.
Definition: ToolChain.cpp:545
clang::driver::ToolChain::getRTTIMode
RTTIMode getRTTIMode() const
Definition: ToolChain.h:277
clang::driver::ToolChain::SelectedMultilib
Multilib SelectedMultilib
Definition: ToolChain.h:182
clang::driver::ToolChain::buildLinker
virtual Tool * buildLinker() const
Definition: ToolChain.cpp:276
clang::driver::ToolChain::getAuxTriple
virtual const llvm::Triple * getAuxTriple() const
Get the toolchain's aux triple, if it has one.
Definition: ToolChain.h:230
clang::driver::ToolChain::IsIntegratedAssemblerDefault
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:382
clang::driver::ToolChain::setTripleEnvironment
void setTripleEnvironment(llvm::Triple::EnvironmentType Env)
Definition: ToolChain.cpp:90
clang::driver::ToolChain::getStdlibPaths
path_list getStdlibPaths() const
Definition: ToolChain.cpp:509
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:537
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:1101
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:674
clang::driver::ToolChain::IsMathErrnoDefault
virtual bool IsMathErrnoDefault() const
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChain.h:395
clang::driver::ToolChain::getArch
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:237
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:965
clang::driver::RegisterEffectiveTriple::~RegisterEffectiveTriple
~RegisterEffectiveTriple()
Definition: ToolChain.h:723
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:942
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:487
clang::driver::ToolChain::IsBlocksDefault
virtual bool IsBlocksDefault() const
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChain.h:378
clang::driver::ToolChain::getCompilerRTBasename
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:419
clang::driver::ToolChain::FT_Static
@ FT_Static
Definition: ToolChain.h:123
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:361
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:793
clang::driver::ToolChain::getPlatform
StringRef getPlatform() const
Definition: ToolChain.h:239
clang::driver::RegisterEffectiveTriple::RegisterEffectiveTriple
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
Definition: ToolChain.h:719
clang::driver::ToolChain::BitCodeLibraryInfo::Path
std::string Path
Definition: ToolChain.h:117
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1008
clang::driver::ToolChain::getTool
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:326
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:885
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:948
clang::driver::ToolChain::getArchSpecificLibPath
std::string getArchSpecificLibPath() const
Definition: ToolChain.cpp:518
clang::driver::ToolChain::RM_Enabled
@ RM_Enabled
Definition: ToolChain.h:112
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:701
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:767
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:759
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:481
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:562
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:509
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:1033
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:636
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:706
clang::driver::ToolChain::useIntegratedAs
virtual bool useIntegratedAs() const
Check if the toolchain should use the integrated assembler.
Definition: ToolChain.cpp:102
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:931
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:744
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:691
LLVM.h
clang::driver::ToolChain::SupportsEmbeddedBitcode
virtual bool SupportsEmbeddedBitcode() const
SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
Definition: ToolChain.h:545
clang::driver::ToolChain::getLibraryPaths
path_list & getLibraryPaths()
Definition: ToolChain.h:256
clang::driver::phases::IfsMerge
@ IfsMerge
Definition: Phases.h:24
clang::driver::ToolChain::getMaxDwarfVersion
virtual unsigned getMaxDwarfVersion() const
Definition: ToolChain.h:518
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::ToolChain::BitCodeLibraryInfo::BitCodeLibraryInfo
BitCodeLibraryInfo(StringRef Path, bool ShouldInternalize=true)
Definition: ToolChain.h:119
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:389
clang::driver::ToolChain::FileType
FileType
Definition: ToolChain.h:123
clang::driver::ToolChain::GetDefaultCXXStdlibType
virtual CXXStdlibType GetDefaultCXXStdlibType() const
Definition: ToolChain.h:433
clang::driver::ToolChain::GetCXXStdlibType
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:829
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:1044
clang::driver::ToolChain::GetDefaultUnwindLibType
virtual UnwindLibType GetDefaultUnwindLibType() const
Definition: ToolChain.h:437
Sanitizers.h
clang::driver::ToolChain::isThreadModelSupported
virtual bool isThreadModelSupported(const StringRef Model) const
isThreadModelSupported() - Does this target support a thread model?
Definition: ToolChain.cpp:678
clang::driver::ToolChain::CheckObjCARC
virtual void CheckObjCARC() const
Complain if this tool chain doesn't support Objective-C ARC.
Definition: ToolChain.h:500
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:59
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:306
clang::driver::ToolChain::getFilePaths
const path_list & getFilePaths() const
Definition: ToolChain.h:260
clang::driver::ToolChain::getLibraryPaths
const path_list & getLibraryPaths() const
Definition: ToolChain.h:257
clang::driver::ToolChain::Multilibs
MultilibSet Multilibs
Definition: ToolChain.h:181
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:1036
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:870
clang::driver::RegisterEffectiveTriple
Set a ToolChain's effective triple.
Definition: ToolChain.h:715
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:539
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:753
clang::driver::ToolChain::isCrossCompiling
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChain.cpp:652
clang::driver::ToolChain::RTTIMode
RTTIMode
Definition: ToolChain.h:111
clang::driver::ToolChain::getXRayArgs
const XRayArgs & getXRayArgs() const
Definition: ToolChain.cpp:119
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:85
clang::driver::ToolChain::useRelaxRelocations
virtual bool useRelaxRelocations() const
Check whether to enable x86 relax relocations by default.
Definition: ToolChain.cpp:108
clang::driver::ToolChain::~ToolChain
virtual ~ToolChain()
llvm::SmallVectorImpl
Definition: LLVM.h:39
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:855
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:532
clang::driver::ToolChain::FT_Shared
@ FT_Shared
Definition: ToolChain.h:123
clang::driver::JobAction
Definition: Action.h:380
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:415
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:497
clang::driver::ToolChain::GetDefaultRuntimeLibType
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:429
clang::driver::ToolChain::buildAssembler
virtual Tool * buildAssembler() const
Definition: ToolChain.cpp:272
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::driver::ToolChain::GetStaticLibToolPath
std::string GetStaticLibToolPath() const
Returns the linker path for emitting a static library.
Definition: ToolChain.cpp:629
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:739
clang::driver::ToolChain::RM_Disabled
@ RM_Disabled
Definition: ToolChain.h:113