clang  3.8.0
ToolChain.h
Go to the documentation of this file.
1 //===--- ToolChain.h - Collections of tools for one platform ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H
11 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
12 
13 #include "clang/Basic/Sanitizers.h"
14 #include "clang/Driver/Action.h"
15 #include "clang/Driver/Multilib.h"
16 #include "clang/Driver/Types.h"
17 #include "clang/Driver/Util.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Path.h"
21 #include "llvm/Target/TargetOptions.h"
22 #include <memory>
23 #include <string>
24 
25 namespace llvm {
26 namespace opt {
27  class ArgList;
28  class DerivedArgList;
29  class InputArgList;
30 }
31 }
32 
33 namespace clang {
34 class ObjCRuntime;
35 namespace vfs {
36 class FileSystem;
37 }
38 
39 namespace driver {
40  class Compilation;
41  class Driver;
42  class JobAction;
43  class SanitizerArgs;
44  class Tool;
45 
46 /// ToolChain - Access to tools for a single platform.
47 class ToolChain {
48 public:
50 
54  };
55 
59  };
60 
61  enum RTTIMode {
66  };
67 
68 private:
69  const Driver &D;
70  const llvm::Triple Triple;
71  const llvm::opt::ArgList &Args;
72  // We need to initialize CachedRTTIArg before CachedRTTIMode
73  const llvm::opt::Arg *const CachedRTTIArg;
74  const RTTIMode CachedRTTIMode;
75 
76  /// The list of toolchain specific path prefixes to search for
77  /// files.
78  path_list FilePaths;
79 
80  /// The list of toolchain specific path prefixes to search for
81  /// programs.
82  path_list ProgramPaths;
83 
84  mutable std::unique_ptr<Tool> Clang;
85  mutable std::unique_ptr<Tool> Assemble;
86  mutable std::unique_ptr<Tool> Link;
87  Tool *getClang() const;
88  Tool *getAssemble() const;
89  Tool *getLink() const;
90  Tool *getClangAs() const;
91 
92  mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
93 
94 protected:
96  const char *DefaultLinker = "ld";
97 
98  ToolChain(const Driver &D, const llvm::Triple &T,
99  const llvm::opt::ArgList &Args);
100 
101  virtual Tool *buildAssembler() const;
102  virtual Tool *buildLinker() const;
103  virtual Tool *getTool(Action::ActionClass AC) const;
104 
105  /// \name Utilities for implementing subclasses.
106  ///@{
107  static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
108  llvm::opt::ArgStringList &CC1Args,
109  const Twine &Path);
110  static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
111  llvm::opt::ArgStringList &CC1Args,
112  const Twine &Path);
113  static void
114  addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
115  llvm::opt::ArgStringList &CC1Args,
116  const Twine &Path);
117  static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
118  llvm::opt::ArgStringList &CC1Args,
119  ArrayRef<StringRef> Paths);
120  ///@}
121 
122 public:
123  virtual ~ToolChain();
124 
125  // Accessors
126 
127  const Driver &getDriver() const { return D; }
128  vfs::FileSystem &getVFS() const;
129  const llvm::Triple &getTriple() const { return Triple; }
130 
131  llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
132  StringRef getArchName() const { return Triple.getArchName(); }
133  StringRef getPlatform() const { return Triple.getVendorName(); }
134  StringRef getOS() const { return Triple.getOSName(); }
135 
136  /// \brief Provide the default architecture name (as expected by -arch) for
137  /// this toolchain.
138  StringRef getDefaultUniversalArchName() const;
139 
140  std::string getTripleString() const {
141  return Triple.getTriple();
142  }
143 
144  path_list &getFilePaths() { return FilePaths; }
145  const path_list &getFilePaths() const { return FilePaths; }
146 
147  path_list &getProgramPaths() { return ProgramPaths; }
148  const path_list &getProgramPaths() const { return ProgramPaths; }
149 
150  const MultilibSet &getMultilibs() const { return Multilibs; }
151 
152  const SanitizerArgs& getSanitizerArgs() const;
153 
154  // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
155  const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
156 
157  // Returns the RTTIMode for the toolchain with the current arguments.
158  RTTIMode getRTTIMode() const { return CachedRTTIMode; }
159 
160  /// \brief Return any implicit target and/or mode flag for an invocation of
161  /// the compiler driver as `ProgName`.
162  ///
163  /// For example, when called with i686-linux-android-g++, the first element
164  /// of the return value will be set to `"i686-linux-android"` and the second
165  /// will be set to "--driver-mode=g++"`.
166  ///
167  /// \pre `llvm::InitializeAllTargets()` has been called.
168  /// \param ProgName The name the Clang driver was invoked with (from,
169  /// e.g., argv[0])
170  /// \return A pair of (`target`, `mode-flag`), where one or both may be empty.
171  static std::pair<std::string, std::string>
172  getTargetAndModeFromProgramName(StringRef ProgName);
173 
174  // Tool access.
175 
176  /// TranslateArgs - Create a new derived argument list for any argument
177  /// translations this ToolChain may wish to perform, or 0 if no tool chain
178  /// specific translations are needed.
179  ///
180  /// \param BoundArch - The bound architecture name, or 0.
181  virtual llvm::opt::DerivedArgList *
182  TranslateArgs(const llvm::opt::DerivedArgList &Args,
183  const char *BoundArch) const {
184  return nullptr;
185  }
186 
187  /// Choose a tool to use to handle the action \p JA.
188  ///
189  /// This can be overridden when a particular ToolChain needs to use
190  /// a compiler other than Clang.
191  virtual Tool *SelectTool(const JobAction &JA) const;
192 
193  // Helper methods
194 
195  std::string GetFilePath(const char *Name) const;
196  std::string GetProgramPath(const char *Name) const;
197 
198  /// Returns the linker path, respecting the -fuse-ld= argument to determine
199  /// the linker suffix or name.
200  std::string GetLinkerPath() const;
201 
202  /// \brief Dispatch to the specific toolchain for verbose printing.
203  ///
204  /// This is used when handling the verbose option to print detailed,
205  /// toolchain-specific information useful for understanding the behavior of
206  /// the driver on a specific platform.
207  virtual void printVerboseInfo(raw_ostream &OS) const {}
208 
209  // Platform defaults information
210 
211  /// \brief Returns true if the toolchain is targeting a non-native
212  /// architecture.
213  virtual bool isCrossCompiling() const;
214 
215  /// HasNativeLTOLinker - Check whether the linker and related tools have
216  /// native LLVM support.
217  virtual bool HasNativeLLVMSupport() const;
218 
219  /// LookupTypeForExtension - Return the default language type to use for the
220  /// given extension.
221  virtual types::ID LookupTypeForExtension(const char *Ext) const;
222 
223  /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
224  virtual bool IsBlocksDefault() const { return false; }
225 
226  /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
227  /// by default.
228  virtual bool IsIntegratedAssemblerDefault() const { return false; }
229 
230  /// \brief Check if the toolchain should use the integrated assembler.
231  bool useIntegratedAs() const;
232 
233  /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
234  virtual bool IsMathErrnoDefault() const { return true; }
235 
236  /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
237  /// -fencode-extended-block-signature by default.
238  virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
239 
240  /// IsObjCNonFragileABIDefault - Does this tool chain set
241  /// -fobjc-nonfragile-abi by default.
242  virtual bool IsObjCNonFragileABIDefault() const { return false; }
243 
244  /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
245  /// mixed dispatch method be used?
246  virtual bool UseObjCMixedDispatch() const { return false; }
247 
248  /// GetDefaultStackProtectorLevel - Get the default stack protector level for
249  /// this tool chain (0=off, 1=on, 2=strong, 3=all).
250  virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
251  return 0;
252  }
253 
254  /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
256  return ToolChain::RLT_Libgcc;
257  }
258 
259  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
260  StringRef Component,
261  bool Shared = false) const;
262 
263  const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
264  StringRef Component,
265  bool Shared = false) const;
266  /// needsProfileRT - returns true if instrumentation profile is on.
267  static bool needsProfileRT(const llvm::opt::ArgList &Args);
268 
269  /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
270  /// by default.
271  virtual bool IsUnwindTablesDefault() const;
272 
273  /// \brief Test whether this toolchain defaults to PIC.
274  virtual bool isPICDefault() const = 0;
275 
276  /// \brief Test whether this toolchain defaults to PIE.
277  virtual bool isPIEDefault() const = 0;
278 
279  /// \brief Tests whether this toolchain forces its default for PIC, PIE or
280  /// non-PIC. If this returns true, any PIC related flags should be ignored
281  /// and instead the results of \c isPICDefault() and \c isPIEDefault() are
282  /// used exclusively.
283  virtual bool isPICDefaultForced() const = 0;
284 
285  /// SupportsProfiling - Does this tool chain support -pg.
286  virtual bool SupportsProfiling() const { return true; }
287 
288  /// Does this tool chain support Objective-C garbage collection.
289  virtual bool SupportsObjCGC() const { return true; }
290 
291  /// Complain if this tool chain doesn't support Objective-C ARC.
292  virtual void CheckObjCARC() const {}
293 
294  /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
295  /// compile unit information.
296  virtual bool UseDwarfDebugFlags() const { return false; }
297 
298  // Return the DWARF version to emit, in the absence of arguments
299  // to the contrary.
300  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
301 
302  // True if the driver should assume "-fstandalone-debug"
303  // in the absence of an option specifying otherwise,
304  // provided that debugging was requested in the first place.
305  // i.e. a value of 'true' does not imply that debugging is wanted.
306  virtual bool GetDefaultStandaloneDebug() const { return false; }
307 
308  // Return the default debugger "tuning."
309  virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
310  return llvm::DebuggerKind::GDB;
311  }
312 
313  /// UseSjLjExceptions - Does this tool chain use SjLj exceptions.
314  virtual bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const {
315  return false;
316  }
317 
318  /// getThreadModel() - Which thread model does this target use?
319  virtual std::string getThreadModel() const { return "posix"; }
320 
321  /// isThreadModelSupported() - Does this target support a thread model?
322  virtual bool isThreadModelSupported(const StringRef Model) const;
323 
324  /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
325  /// command line arguments into account.
326  virtual std::string
327  ComputeLLVMTriple(const llvm::opt::ArgList &Args,
328  types::ID InputType = types::TY_INVALID) const;
329 
330  /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
331  /// target, which may take into account the command line arguments. For
332  /// example, on Darwin the -mmacosx-version-min= command line argument (which
333  /// sets the deployment target) determines the version in the triple passed to
334  /// Clang.
335  virtual std::string ComputeEffectiveClangTriple(
336  const llvm::opt::ArgList &Args,
337  types::ID InputType = types::TY_INVALID) const;
338 
339  /// getDefaultObjCRuntime - Return the default Objective-C runtime
340  /// for this platform.
341  ///
342  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
343  virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
344 
345  /// hasBlocksRuntime - Given that the user is compiling with
346  /// -fblocks, does this tool chain guarantee the existence of a
347  /// blocks runtime?
348  ///
349  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
350  virtual bool hasBlocksRuntime() const { return true; }
351 
352  /// \brief Add the clang cc1 arguments for system include paths.
353  ///
354  /// This routine is responsible for adding the necessary cc1 arguments to
355  /// include headers from standard system header directories.
356  virtual void
357  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
358  llvm::opt::ArgStringList &CC1Args) const;
359 
360  /// \brief Add options that need to be passed to cc1 for this target.
361  virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
362  llvm::opt::ArgStringList &CC1Args) const;
363 
364  /// \brief Add warning options that need to be passed to cc1 for this target.
365  virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
366 
367  // GetRuntimeLibType - Determine the runtime library type to use with the
368  // given compilation arguments.
369  virtual RuntimeLibType
370  GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
371 
372  // GetCXXStdlibType - Determine the C++ standard library type to use with the
373  // given compilation arguments.
374  virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
375 
376  /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
377  /// the include paths to use for the given C++ standard library type.
378  virtual void
379  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
380  llvm::opt::ArgStringList &CC1Args) const;
381 
382  /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
383  /// for the given C++ standard library type.
384  virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
385  llvm::opt::ArgStringList &CmdArgs) const;
386 
387  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
388  void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
389  llvm::opt::ArgStringList &CmdArgs) const;
390 
391  /// AddCCKextLibArgs - Add the system specific linker arguments to use
392  /// for kernel extensions (Darwin-specific).
393  virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
394  llvm::opt::ArgStringList &CmdArgs) const;
395 
396  /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
397  /// global flags for unsafe floating point math, add it and return true.
398  ///
399  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
400  virtual bool AddFastMathRuntimeIfAvailable(
401  const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
402  /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
403  /// a suitable profile runtime library to the linker.
404  virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
405  llvm::opt::ArgStringList &CmdArgs) const;
406 
407  /// \brief Add arguments to use system-specific CUDA includes.
408  virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
409  llvm::opt::ArgStringList &CC1Args) const;
410 
411  /// \brief Return sanitizers which are available in this toolchain.
412  virtual SanitizerMask getSupportedSanitizers() const;
413 };
414 
415 } // end namespace driver
416 } // end namespace clang
417 
418 #endif
const llvm::Triple & getTriple() const
Definition: ToolChain.h:129
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:566
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:513
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:240
virtual Tool * SelectTool(const JobAction &JA) const
Choose a tool to use to handle the action JA.
Definition: ToolChain.cpp:326
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:49
static void addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Definition: ToolChain.cpp:573
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:338
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:536
virtual 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:631
virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChain.h:250
virtual bool hasBlocksRuntime() const
hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the...
Definition: ToolChain.h:350
virtual llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, const char *BoundArch) const
TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may w...
Definition: ToolChain.h:182
bool useIntegratedAs() const
Check if the toolchain should use the integrated assembler.
Definition: ToolChain.cpp:82
virtual bool IsMathErrnoDefault() const
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChain.h:234
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:131
virtual Tool * buildAssembler() const
Definition: ToolChain.cpp:214
virtual bool isPICDefaultForced() const =0
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:655
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:626
virtual bool isThreadModelSupported(const StringRef Model) const
isThreadModelSupported() - Does this target support a thread model?
Definition: ToolChain.cpp:394
Defines the clang::SanitizerKind enum.
The virtual file system interface.
virtual bool SupportsObjCGC() const
Does this tool chain support Objective-C garbage collection.
Definition: ToolChain.h:289
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4381
virtual void printVerboseInfo(raw_ostream &OS) const
Dispatch to the specific toolchain for verbose printing.
Definition: ToolChain.h:207
path_list & getProgramPaths()
Definition: ToolChain.h:147
virtual bool HasNativeLLVMSupport() const
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: ToolChain.cpp:369
virtual std::string getThreadModel() const
getThreadModel() - Which thread model does this target use?
Definition: ToolChain.h:319
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChain.cpp:373
static bool needsProfileRT(const llvm::opt::ArgList &Args)
needsProfileRT - returns true if instrumentation profile is on.
Definition: ToolChain.cpp:312
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:604
virtual bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const
UseSjLjExceptions - Does this tool chain use SjLj exceptions.
Definition: ToolChain.h:314
std::string getTripleString() const
Definition: ToolChain.h:140
path_list & getFilePaths()
Definition: ToolChain.h:144
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:65
const Driver & getDriver() const
Definition: ToolChain.h:127
ToolChain(const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args)
Definition: ToolChain.cpp:67
StringRef getArchName() const
Definition: ToolChain.h:132
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:255
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, bool Shared=false) const
Definition: ToolChain.cpp:286
StringRef getOS() const
Definition: ToolChain.h:134
virtual RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:521
virtual bool isPICDefault() const =0
Test whether this toolchain defaults to PIC.
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:581
const path_list & getProgramPaths() const
Definition: ToolChain.h:148
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:511
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:409
static std::pair< std::string, std::string > getTargetAndModeFromProgramName(StringRef ProgName)
Return any implicit target and/or mode flag for an invocation of the compiler driver as ProgName...
Definition: ToolChain.cpp:164
virtual void CheckObjCARC() const
Complain if this tool chain doesn't support Objective-C ARC.
Definition: ToolChain.h:292
virtual bool IsBlocksDefault() const
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChain.h:224
const llvm::opt::Arg * getRTTIArg() const
Definition: ToolChain.h:155
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:590
virtual bool UseObjCMixedDispatch() const
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChain.h:246
StringRef getDefaultUniversalArchName() const
Provide the default architecture name (as expected by -arch) for this toolchain.
Definition: ToolChain.cpp:187
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:497
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:507
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:551
virtual bool IsEncodeExtendedBlockSignatureDefault() const
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChain.h:238
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:502
const MultilibSet & getMultilibs() const
Definition: ToolChain.h:150
RTTIMode getRTTIMode() const
Definition: ToolChain.h:158
uint64_t SanitizerMask
Definition: Sanitizers.h:24
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:25
const char * getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component, bool Shared=false) const
Definition: ToolChain.cpp:306
MultilibSet Multilibs
Definition: ToolChain.h:95
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
virtual llvm::DebuggerKind getDefaultDebuggerTuning() const
Definition: ToolChain.h:309
virtual bool IsObjCNonFragileABIDefault() const
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChain.h:242
virtual bool isPIEDefault() const =0
Test whether this toolchain defaults to PIE.
virtual bool SupportsProfiling() const
SupportsProfiling - Does this tool chain support -pg.
Definition: ToolChain.h:286
virtual Tool * buildLinker() const
Definition: ToolChain.cpp:218
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:619
vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:80
virtual bool GetDefaultStandaloneDebug() const
Definition: ToolChain.h:306
virtual bool IsUnwindTablesDefault() const
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: ToolChain.cpp:204
const path_list & getFilePaths() const
Definition: ToolChain.h:145
virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const
getDefaultObjCRuntime - Return the default Objective-C runtime for this platform. ...
Definition: ToolChain.cpp:389
virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific CUDA includes.
Definition: ToolChain.cpp:667
const char * DefaultLinker
Definition: ToolChain.h:96
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:228
virtual bool UseDwarfDebugFlags() const
UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information...
Definition: ToolChain.h:296
virtual unsigned GetDefaultDwarfVersion() const
Definition: ToolChain.h:300
std::string GetLinkerPath() const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name...
Definition: ToolChain.cpp:342
StringRef getPlatform() const
Definition: ToolChain.h:133
const SanitizerArgs & getSanitizerArgs() const
Definition: ToolChain.cpp:88
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:334
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:47
virtual types::ID LookupTypeForExtension(const char *Ext) const
LookupTypeForExtension - Return the default language type to use for the given extension.
Definition: ToolChain.cpp:365