clang  10.0.0svn
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/ArrayRef.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Triple.h"
23 #include "llvm/MC/MCTargetOptions.h"
24 #include "llvm/Option/Option.h"
25 #include "llvm/Support/VersionTuple.h"
26 #include "llvm/Target/TargetOptions.h"
27 #include <cassert>
28 #include <memory>
29 #include <string>
30 #include <utility>
31 
32 namespace llvm {
33 namespace opt {
34 
35 class Arg;
36 class ArgList;
37 class DerivedArgList;
38 
39 } // namespace opt
40 namespace vfs {
41 
42 class FileSystem;
43 
44 } // namespace vfs
45 } // namespace llvm
46 
47 namespace clang {
48 
49 class ObjCRuntime;
50 
51 namespace driver {
52 
53 class Driver;
54 class InputInfo;
55 class SanitizerArgs;
56 class Tool;
57 class XRayArgs;
58 
59 /// Helper structure used to pass information extracted from clang executable
60 /// name such as `i686-linux-android-g++`.
62  /// Target part of the executable name, as `i686-linux-android`.
63  std::string TargetPrefix;
64 
65  /// Driver mode part of the executable name, as `g++`.
66  std::string ModeSuffix;
67 
68  /// Corresponding driver mode argument, as '--driver-mode=g++'
69  const char *DriverMode = nullptr;
70 
71  /// True if TargetPrefix is recognized as a registered target name.
72  bool TargetIsValid = false;
73 
74  ParsedClangName() = default;
75  ParsedClangName(std::string Suffix, const char *Mode)
76  : ModeSuffix(Suffix), DriverMode(Mode) {}
77  ParsedClangName(std::string Target, std::string Suffix, const char *Mode,
78  bool IsRegistered)
79  : TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
80  TargetIsValid(IsRegistered) {}
81 
82  bool isEmpty() const {
83  return TargetPrefix.empty() && ModeSuffix.empty() && DriverMode == nullptr;
84  }
85 };
86 
87 /// ToolChain - Access to tools for a single platform.
88 class ToolChain {
89 public:
91 
94  CST_Libstdcxx
95  };
96 
99  RLT_Libgcc
100  };
101 
105  UNW_Libgcc
106  };
107 
108  enum RTTIMode {
111  };
112 
113  enum FileType { FT_Object, FT_Static, FT_Shared };
114 
115 private:
117 
118  const Driver &D;
119  llvm::Triple Triple;
120  const llvm::opt::ArgList &Args;
121 
122  // We need to initialize CachedRTTIArg before CachedRTTIMode
123  const llvm::opt::Arg *const CachedRTTIArg;
124 
125  const RTTIMode CachedRTTIMode;
126 
127  /// The list of toolchain specific path prefixes to search for libraries.
128  path_list LibraryPaths;
129 
130  /// The list of toolchain specific path prefixes to search for files.
131  path_list FilePaths;
132 
133  /// The list of toolchain specific path prefixes to search for programs.
134  path_list ProgramPaths;
135 
136  mutable std::unique_ptr<Tool> Clang;
137  mutable std::unique_ptr<Tool> Assemble;
138  mutable std::unique_ptr<Tool> Link;
139  mutable std::unique_ptr<Tool> IfsMerge;
140  mutable std::unique_ptr<Tool> OffloadBundler;
141  mutable std::unique_ptr<Tool> OffloadWrapper;
142 
143  Tool *getClang() const;
144  Tool *getAssemble() const;
145  Tool *getLink() const;
146  Tool *getIfsMerge() const;
147  Tool *getClangAs() const;
148  Tool *getOffloadBundler() const;
149  Tool *getOffloadWrapper() const;
150 
151  mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
152  mutable std::unique_ptr<XRayArgs> XRayArguments;
153 
154  /// The effective clang triple for the current Job.
155  mutable llvm::Triple EffectiveTriple;
156 
157  /// Set the toolchain's effective clang triple.
158  void setEffectiveTriple(llvm::Triple ET) const {
159  EffectiveTriple = std::move(ET);
160  }
161 
162 protected:
165 
166  ToolChain(const Driver &D, const llvm::Triple &T,
167  const llvm::opt::ArgList &Args);
168 
169  void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
170 
171  virtual Tool *buildAssembler() const;
172  virtual Tool *buildLinker() const;
173  virtual Tool *getTool(Action::ActionClass AC) const;
174 
175  /// \name Utilities for implementing subclasses.
176  ///@{
177  static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
178  llvm::opt::ArgStringList &CC1Args,
179  const Twine &Path);
180  static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
181  llvm::opt::ArgStringList &CC1Args,
182  const Twine &Path);
183  static void
184  addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
185  llvm::opt::ArgStringList &CC1Args,
186  const Twine &Path);
187  static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
188  llvm::opt::ArgStringList &CC1Args,
189  ArrayRef<StringRef> Paths);
190  ///@}
191 
192 public:
193  virtual ~ToolChain();
194 
195  // Accessors
196 
197  const Driver &getDriver() const { return D; }
198  llvm::vfs::FileSystem &getVFS() const;
199  const llvm::Triple &getTriple() const { return Triple; }
200 
201  /// Get the toolchain's aux triple, if it has one.
202  ///
203  /// Exactly what the aux triple represents depends on the toolchain, but for
204  /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
205  /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
206  virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
207 
208  /// Some toolchains need to modify the file name, for example to replace the
209  /// extension for object files with .cubin for OpenMP offloading to Nvidia
210  /// GPUs.
211  virtual std::string getInputFilename(const InputInfo &Input) const;
212 
213  llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
214  StringRef getArchName() const { return Triple.getArchName(); }
215  StringRef getPlatform() const { return Triple.getVendorName(); }
216  StringRef getOS() const { return Triple.getOSName(); }
217 
218  /// Provide the default architecture name (as expected by -arch) for
219  /// this toolchain.
220  StringRef getDefaultUniversalArchName() const;
221 
222  std::string getTripleString() const {
223  return Triple.getTriple();
224  }
225 
226  /// Get the toolchain's effective clang triple.
227  const llvm::Triple &getEffectiveTriple() const {
228  assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
229  return EffectiveTriple;
230  }
231 
232  path_list &getLibraryPaths() { return LibraryPaths; }
233  const path_list &getLibraryPaths() const { return LibraryPaths; }
234 
235  path_list &getFilePaths() { return FilePaths; }
236  const path_list &getFilePaths() const { return FilePaths; }
237 
238  path_list &getProgramPaths() { return ProgramPaths; }
239  const path_list &getProgramPaths() const { return ProgramPaths; }
240 
241  const MultilibSet &getMultilibs() const { return Multilibs; }
242 
243  const Multilib &getMultilib() const { return SelectedMultilib; }
244 
245  const SanitizerArgs& getSanitizerArgs() const;
246 
247  const XRayArgs& getXRayArgs() const;
248 
249  // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
250  const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
251 
252  // Returns the RTTIMode for the toolchain with the current arguments.
253  RTTIMode getRTTIMode() const { return CachedRTTIMode; }
254 
255  /// Return any implicit target and/or mode flag for an invocation of
256  /// the compiler driver as `ProgName`.
257  ///
258  /// For example, when called with i686-linux-android-g++, the first element
259  /// of the return value will be set to `"i686-linux-android"` and the second
260  /// will be set to "--driver-mode=g++"`.
261  /// It is OK if the target name is not registered. In this case the return
262  /// value contains false in the field TargetIsValid.
263  ///
264  /// \pre `llvm::InitializeAllTargets()` has been called.
265  /// \param ProgName The name the Clang driver was invoked with (from,
266  /// e.g., argv[0]).
267  /// \return A structure of type ParsedClangName that contains the executable
268  /// name parts.
269  static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName);
270 
271  // Tool access.
272 
273  /// TranslateArgs - Create a new derived argument list for any argument
274  /// translations this ToolChain may wish to perform, or 0 if no tool chain
275  /// specific translations are needed. If \p DeviceOffloadKind is specified
276  /// the translation specific for that offload kind is performed.
277  ///
278  /// \param BoundArch - The bound architecture name, or 0.
279  /// \param DeviceOffloadKind - The device offload kind used for the
280  /// translation.
281  virtual llvm::opt::DerivedArgList *
282  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
283  Action::OffloadKind DeviceOffloadKind) const {
284  return nullptr;
285  }
286 
287  /// TranslateOpenMPTargetArgs - Create a new derived argument list for
288  /// that contains the OpenMP target specific flags passed via
289  /// -Xopenmp-target -opt=val OR -Xopenmp-target=<triple> -opt=val
290  virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
291  const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
292  SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
293 
294  /// Choose a tool to use to handle the action \p JA.
295  ///
296  /// This can be overridden when a particular ToolChain needs to use
297  /// a compiler other than Clang.
298  virtual Tool *SelectTool(const JobAction &JA) const;
299 
300  // Helper methods
301 
302  std::string GetFilePath(const char *Name) const;
303  std::string GetProgramPath(const char *Name) const;
304 
305  /// Returns the linker path, respecting the -fuse-ld= argument to determine
306  /// the linker suffix or name.
307  std::string GetLinkerPath() const;
308 
309  /// Dispatch to the specific toolchain for verbose printing.
310  ///
311  /// This is used when handling the verbose option to print detailed,
312  /// toolchain-specific information useful for understanding the behavior of
313  /// the driver on a specific platform.
314  virtual void printVerboseInfo(raw_ostream &OS) const {}
315 
316  // Platform defaults information
317 
318  /// Returns true if the toolchain is targeting a non-native
319  /// architecture.
320  virtual bool isCrossCompiling() const;
321 
322  /// HasNativeLTOLinker - Check whether the linker and related tools have
323  /// native LLVM support.
324  virtual bool HasNativeLLVMSupport() const;
325 
326  /// LookupTypeForExtension - Return the default language type to use for the
327  /// given extension.
328  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
329 
330  /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
331  virtual bool IsBlocksDefault() const { return false; }
332 
333  /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
334  /// by default.
335  virtual bool IsIntegratedAssemblerDefault() const { return false; }
336 
337  /// Check if the toolchain should use the integrated assembler.
338  virtual bool useIntegratedAs() const;
339 
340  /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
341  virtual bool IsMathErrnoDefault() const { return true; }
342 
343  /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
344  /// -fencode-extended-block-signature by default.
345  virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
346 
347  /// IsObjCNonFragileABIDefault - Does this tool chain set
348  /// -fobjc-nonfragile-abi by default.
349  virtual bool IsObjCNonFragileABIDefault() const { return false; }
350 
351  /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
352  /// mixed dispatch method be used?
353  virtual bool UseObjCMixedDispatch() const { return false; }
354 
355  /// Check whether to enable x86 relax relocations by default.
356  virtual bool useRelaxRelocations() const;
357 
358  /// GetDefaultStackProtectorLevel - Get the default stack protector level for
359  /// this tool chain (0=off, 1=on, 2=strong, 3=all).
360  virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
361  return 0;
362  }
363 
364  /// Get the default trivial automatic variable initialization.
368  }
369 
370  /// GetDefaultLinker - Get the default linker to use.
371  virtual const char *getDefaultLinker() const { return "ld"; }
372 
373  /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
375  return ToolChain::RLT_Libgcc;
376  }
377 
379  return ToolChain::CST_Libstdcxx;
380  }
381 
383  return ToolChain::UNW_None;
384  }
385 
386  virtual std::string getCompilerRTPath() const;
387 
388  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
389  StringRef Component,
390  FileType Type = ToolChain::FT_Static) const;
391 
392  const char *
393  getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
394  FileType Type = ToolChain::FT_Static) const;
395 
396  // Returns target specific runtime path if it exists.
397  virtual Optional<std::string> getRuntimePath() const;
398 
399  // Returns target specific C++ library path if it exists.
400  virtual Optional<std::string> getCXXStdlibPath() const;
401 
402  // Returns <ResourceDir>/lib/<OSName>/<arch>. This is used by runtimes (such
403  // as OpenMP) to find arch-specific libraries.
404  std::string getArchSpecificLibPath() const;
405 
406  // Returns <OSname> part of above.
407  StringRef getOSLibName() const;
408 
409  /// needsProfileRT - returns true if instrumentation profile is on.
410  static bool needsProfileRT(const llvm::opt::ArgList &Args);
411 
412  /// Returns true if gcov instrumentation (-fprofile-arcs or --coverage) is on.
413  static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args);
414 
415  /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
416  /// by default.
417  virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const;
418 
419  /// Test whether this toolchain defaults to PIC.
420  virtual bool isPICDefault() const = 0;
421 
422  /// Test whether this toolchain defaults to PIE.
423  virtual bool isPIEDefault() const = 0;
424 
425  /// Test whether this toolchaind defaults to non-executable stacks.
426  virtual bool isNoExecStackDefault() const;
427 
428  /// Tests whether this toolchain forces its default for PIC, PIE or
429  /// non-PIC. If this returns true, any PIC related flags should be ignored
430  /// and instead the results of \c isPICDefault() and \c isPIEDefault() are
431  /// used exclusively.
432  virtual bool isPICDefaultForced() const = 0;
433 
434  /// SupportsProfiling - Does this tool chain support -pg.
435  virtual bool SupportsProfiling() const { return true; }
436 
437  /// Complain if this tool chain doesn't support Objective-C ARC.
438  virtual void CheckObjCARC() const {}
439 
440  /// Get the default debug info format. Typically, this is DWARF.
443  }
444 
445  /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
446  /// compile unit information.
447  virtual bool UseDwarfDebugFlags() const { return false; }
448 
449  // Return the DWARF version to emit, in the absence of arguments
450  // to the contrary.
451  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
452 
453  // True if the driver should assume "-fstandalone-debug"
454  // in the absence of an option specifying otherwise,
455  // provided that debugging was requested in the first place.
456  // i.e. a value of 'true' does not imply that debugging is wanted.
457  virtual bool GetDefaultStandaloneDebug() const { return false; }
458 
459  // Return the default debugger "tuning."
460  virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
461  return llvm::DebuggerKind::GDB;
462  }
463 
464  /// Does this toolchain supports given debug info option or not.
465  virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
466  return true;
467  }
468 
469  /// Adjust debug information kind considering all passed options.
471  const llvm::opt::ArgList &Args) const {}
472 
473  /// GetExceptionModel - Return the tool chain exception model.
474  virtual llvm::ExceptionHandling
475  GetExceptionModel(const llvm::opt::ArgList &Args) const;
476 
477  /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
478  virtual bool SupportsEmbeddedBitcode() const { return false; }
479 
480  /// getThreadModel() - Which thread model does this target use?
481  virtual std::string getThreadModel() const { return "posix"; }
482 
483  /// isThreadModelSupported() - Does this target support a thread model?
484  virtual bool isThreadModelSupported(const StringRef Model) const;
485 
486  /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
487  /// command line arguments into account.
488  virtual std::string
489  ComputeLLVMTriple(const llvm::opt::ArgList &Args,
490  types::ID InputType = types::TY_INVALID) const;
491 
492  /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
493  /// target, which may take into account the command line arguments. For
494  /// example, on Darwin the -mmacosx-version-min= command line argument (which
495  /// sets the deployment target) determines the version in the triple passed to
496  /// Clang.
497  virtual std::string ComputeEffectiveClangTriple(
498  const llvm::opt::ArgList &Args,
499  types::ID InputType = types::TY_INVALID) const;
500 
501  /// getDefaultObjCRuntime - Return the default Objective-C runtime
502  /// for this platform.
503  ///
504  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
505  virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
506 
507  /// hasBlocksRuntime - Given that the user is compiling with
508  /// -fblocks, does this tool chain guarantee the existence of a
509  /// blocks runtime?
510  ///
511  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
512  virtual bool hasBlocksRuntime() const { return true; }
513 
514  /// Add the clang cc1 arguments for system include paths.
515  ///
516  /// This routine is responsible for adding the necessary cc1 arguments to
517  /// include headers from standard system header directories.
518  virtual void
519  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
520  llvm::opt::ArgStringList &CC1Args) const;
521 
522  /// Add options that need to be passed to cc1 for this target.
523  virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
524  llvm::opt::ArgStringList &CC1Args,
525  Action::OffloadKind DeviceOffloadKind) const;
526 
527  /// Add warning options that need to be passed to cc1 for this target.
528  virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
529 
530  // GetRuntimeLibType - Determine the runtime library type to use with the
531  // given compilation arguments.
532  virtual RuntimeLibType
533  GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
534 
535  // GetCXXStdlibType - Determine the C++ standard library type to use with the
536  // given compilation arguments.
537  virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
538 
539  // GetUnwindLibType - Determine the unwind library type to use with the
540  // given compilation arguments.
541  virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
542 
543  /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
544  /// the include paths to use for the given C++ standard library type.
545  virtual void
546  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
547  llvm::opt::ArgStringList &CC1Args) const;
548 
549  /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
550  /// the specified include paths for the C++ standard library.
551  void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
552  llvm::opt::ArgStringList &CC1Args) const;
553 
554  /// Returns if the C++ standard library should be linked in.
555  /// Note that e.g. -lm should still be linked even if this returns false.
556  bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
557 
558  /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
559  /// for the given C++ standard library type.
560  virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
561  llvm::opt::ArgStringList &CmdArgs) const;
562 
563  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
564  void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
565  llvm::opt::ArgStringList &CmdArgs) const;
566 
567  /// AddCCKextLibArgs - Add the system specific linker arguments to use
568  /// for kernel extensions (Darwin-specific).
569  virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
570  llvm::opt::ArgStringList &CmdArgs) const;
571 
572  /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
573  /// global flags for unsafe floating point math, add it and return true.
574  ///
575  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
576  virtual bool AddFastMathRuntimeIfAvailable(
577  const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
578 
579  /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
580  /// a suitable profile runtime library to the linker.
581  virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
582  llvm::opt::ArgStringList &CmdArgs) const;
583 
584  /// Add arguments to use system-specific CUDA includes.
585  virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
586  llvm::opt::ArgStringList &CC1Args) const;
587 
588  /// Add arguments to use MCU GCC toolchain includes.
589  virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
590  llvm::opt::ArgStringList &CC1Args) const;
591 
592  /// On Windows, returns the MSVC compatibility version.
593  virtual VersionTuple computeMSVCVersion(const Driver *D,
594  const llvm::opt::ArgList &Args) const;
595 
596  /// Return sanitizers which are available in this toolchain.
597  virtual SanitizerMask getSupportedSanitizers() const;
598 
599  /// Return sanitizers which are enabled by default.
601  return SanitizerMask();
602  }
603 };
604 
605 /// Set a ToolChain's effective triple. Reset it when the registration object
606 /// is destroyed.
608  const ToolChain &TC;
609 
610 public:
611  RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
612  TC.setEffectiveTriple(std::move(T));
613  }
614 
615  ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
616 };
617 
618 } // namespace driver
619 
620 } // namespace clang
621 
622 #endif // LLVM_CLANG_DRIVER_TOOLCHAIN_H
std::string ModeSuffix
Driver mode part of the executable name, as g++.
Definition: ToolChain.h:66
virtual const char * getDefaultLinker() const
GetDefaultLinker - Get the default linker to use.
Definition: ToolChain.h:371
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
const MultilibSet & getMultilibs() const
Definition: ToolChain.h:241
StringRef getArchName() const
Definition: ToolChain.h:214
Set a ToolChain&#39;s effective triple.
Definition: ToolChain.h:607
virtual bool SupportsProfiling() const
SupportsProfiling - Does this tool chain support -pg.
Definition: ToolChain.h:435
virtual bool UseDwarfDebugFlags() const
UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information...
Definition: ToolChain.h:447
virtual std::string getThreadModel() const
getThreadModel() - Which thread model does this target use?
Definition: ToolChain.h:481
The base class of the type hierarchy.
Definition: Type.h:1436
StringRef getOS() const
Definition: ToolChain.h:216
virtual void printVerboseInfo(raw_ostream &OS) const
Dispatch to the specific toolchain for verbose printing.
Definition: ToolChain.h:314
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
Definition: ToolChain.h:611
Defines the clang::SanitizerKind enum.
virtual bool hasBlocksRuntime() const
hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the...
Definition: ToolChain.h:512
const Multilib & getMultilib() const
Definition: ToolChain.h:243
std::string TargetPrefix
Target part of the executable name, as i686-linux-android.
Definition: ToolChain.h:63
path_list & getProgramPaths()
Definition: ToolChain.h:238
virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChain.h:360
std::string getTripleString() const
Definition: ToolChain.h:222
virtual const llvm::Triple * getAuxTriple() const
Get the toolchain&#39;s aux triple, if it has one.
Definition: ToolChain.h:206
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
path_list & getFilePaths()
Definition: ToolChain.h:235
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
const llvm::opt::Arg * getRTTIArg() const
Definition: ToolChain.h:250
const path_list & getFilePaths() const
Definition: ToolChain.h:236
const path_list & getProgramPaths() const
Definition: ToolChain.h:239
StringRef getPlatform() const
Definition: ToolChain.h:215
virtual void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const
Adjust debug information kind considering all passed options.
Definition: ToolChain.h:470
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:335
Defines the clang::LangOptions interface.
virtual bool SupportsEmbeddedBitcode() const
SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
Definition: ToolChain.h:478
const llvm::Triple & getEffectiveTriple() const
Get the toolchain&#39;s effective clang triple.
Definition: ToolChain.h:227
virtual UnwindLibType GetDefaultUnwindLibType() const
Definition: ToolChain.h:382
virtual bool IsObjCNonFragileABIDefault() const
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChain.h:349
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag...
Definition: Multilib.h:28
ParsedClangName(std::string Suffix, const char *Mode)
Definition: ToolChain.h:75
virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const
Does this toolchain supports given debug info option or not.
Definition: ToolChain.h:465
virtual CXXStdlibType GetDefaultCXXStdlibType() const
Definition: ToolChain.h:378
virtual bool IsMathErrnoDefault() const
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChain.h:341
path_list & getLibraryPaths()
Definition: ToolChain.h:232
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:213
virtual bool UseObjCMixedDispatch() const
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChain.h:353
virtual bool IsEncodeExtendedBlockSignatureDefault() const
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChain.h:345
const Driver & getDriver() const
Definition: ToolChain.h:197
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:61
virtual SanitizerMask getDefaultSanitizers() const
Return sanitizers which are enabled by default.
Definition: ToolChain.h:600
Dataflow Directional Tag Classes.
virtual void CheckObjCARC() const
Complain if this tool chain doesn&#39;t support Objective-C ARC.
Definition: ToolChain.h:438
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:27
virtual llvm::DebuggerKind getDefaultDebuggerTuning() const
Definition: ToolChain.h:460
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
virtual unsigned GetDefaultDwarfVersion() const
Definition: ToolChain.h:451
RTTIMode getRTTIMode() const
Definition: ToolChain.h:253
virtual codegenoptions::DebugInfoFormat getDefaultDebugFormat() const
Get the default debug info format. Typically, this is DWARF.
Definition: ToolChain.h:441
const llvm::Triple & getTriple() const
Definition: ToolChain.h:199
virtual bool GetDefaultStandaloneDebug() const
Definition: ToolChain.h:457
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:282
virtual LangOptions::TrivialAutoVarInitKind GetDefaultTrivialAutoVarInit() const
Get the default trivial automatic variable initialization.
Definition: ToolChain.h:366
const path_list & getLibraryPaths() const
Definition: ToolChain.h:233
ParsedClangName(std::string Target, std::string Suffix, const char *Mode, bool IsRegistered)
Definition: ToolChain.h:77
virtual bool IsBlocksDefault() const
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChain.h:331
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:374
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88