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