clang  3.8.0
ToolChains.h
Go to the documentation of this file.
1 //===--- ToolChains.h - ToolChain Implementations ---------------*- 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_LIB_DRIVER_TOOLCHAINS_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_H
12 
13 #include "Tools.h"
15 #include "clang/Driver/Action.h"
16 #include "clang/Driver/Multilib.h"
17 #include "clang/Driver/ToolChain.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/Support/Compiler.h"
21 #include <set>
22 #include <vector>
23 
24 namespace clang {
25 namespace driver {
26 namespace toolchains {
27 
28 /// Generic_GCC - A tool chain using the 'gcc' command to perform
29 /// all subcommands; this relies on gcc translating the majority of
30 /// command line options.
31 class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain {
32 public:
33  /// \brief Struct to store and manipulate GCC versions.
34  ///
35  /// We rely on assumptions about the form and structure of GCC version
36  /// numbers: they consist of at most three '.'-separated components, and each
37  /// component is a non-negative integer except for the last component. For
38  /// the last component we are very flexible in order to tolerate release
39  /// candidates or 'x' wildcards.
40  ///
41  /// Note that the ordering established among GCCVersions is based on the
42  /// preferred version string to use. For example we prefer versions without
43  /// a hard-coded patch number to those with a hard coded patch number.
44  ///
45  /// Currently this doesn't provide any logic for textual suffixes to patches
46  /// in the way that (for example) Debian's version format does. If that ever
47  /// becomes necessary, it can be added.
48  struct GCCVersion {
49  /// \brief The unparsed text of the version.
50  std::string Text;
51 
52  /// \brief The parsed major, minor, and patch numbers.
53  int Major, Minor, Patch;
54 
55  /// \brief The text of the parsed major, and major+minor versions.
56  std::string MajorStr, MinorStr;
57 
58  /// \brief Any textual suffix on the patch number.
59  std::string PatchSuffix;
60 
61  static GCCVersion Parse(StringRef VersionText);
62  bool isOlderThan(int RHSMajor, int RHSMinor, int RHSPatch,
63  StringRef RHSPatchSuffix = StringRef()) const;
64  bool operator<(const GCCVersion &RHS) const {
65  return isOlderThan(RHS.Major, RHS.Minor, RHS.Patch, RHS.PatchSuffix);
66  }
67  bool operator>(const GCCVersion &RHS) const { return RHS < *this; }
68  bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); }
69  bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); }
70  };
71 
72  /// \brief This is a class to find a viable GCC installation for Clang to
73  /// use.
74  ///
75  /// This class tries to find a GCC installation on the system, and report
76  /// information about it. It starts from the host information provided to the
77  /// Driver, and has logic for fuzzing that where appropriate.
79  bool IsValid;
80  llvm::Triple GCCTriple;
81  const Driver &D;
82 
83  // FIXME: These might be better as path objects.
84  std::string GCCInstallPath;
85  std::string GCCParentLibPath;
86 
87  /// The primary multilib appropriate for the given flags.
88  Multilib SelectedMultilib;
89  /// On Biarch systems, this corresponds to the default multilib when
90  /// targeting the non-default multilib. Otherwise, it is empty.
91  llvm::Optional<Multilib> BiarchSibling;
92 
93  GCCVersion Version;
94 
95  // We retain the list of install paths that were considered and rejected in
96  // order to print out detailed information in verbose mode.
97  std::set<std::string> CandidateGCCInstallPaths;
98 
99  /// The set of multilibs that the detected installation supports.
100  MultilibSet Multilibs;
101 
102  public:
103  explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
104  void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args,
105  ArrayRef<std::string> ExtraTripleAliases = None);
106 
107  /// \brief Check whether we detected a valid GCC install.
108  bool isValid() const { return IsValid; }
109 
110  /// \brief Get the GCC triple for the detected install.
111  const llvm::Triple &getTriple() const { return GCCTriple; }
112 
113  /// \brief Get the detected GCC installation path.
114  StringRef getInstallPath() const { return GCCInstallPath; }
115 
116  /// \brief Get the detected GCC parent lib path.
117  StringRef getParentLibPath() const { return GCCParentLibPath; }
118 
119  /// \brief Get the detected Multilib
120  const Multilib &getMultilib() const { return SelectedMultilib; }
121 
122  /// \brief Get the whole MultilibSet
123  const MultilibSet &getMultilibs() const { return Multilibs; }
124 
125  /// Get the biarch sibling multilib (if it exists).
126  /// \return true iff such a sibling exists
127  bool getBiarchSibling(Multilib &M) const;
128 
129  /// \brief Get the detected GCC version string.
130  const GCCVersion &getVersion() const { return Version; }
131 
132  /// \brief Print information about the detected GCC installation.
133  void print(raw_ostream &OS) const;
134 
135  private:
136  static void
137  CollectLibDirsAndTriples(const llvm::Triple &TargetTriple,
138  const llvm::Triple &BiarchTriple,
140  SmallVectorImpl<StringRef> &TripleAliases,
141  SmallVectorImpl<StringRef> &BiarchLibDirs,
142  SmallVectorImpl<StringRef> &BiarchTripleAliases);
143 
144  void ScanLibDirForGCCTriple(const llvm::Triple &TargetArch,
145  const llvm::opt::ArgList &Args,
146  const std::string &LibDir,
147  StringRef CandidateTriple,
148  bool NeedsBiarchSuffix = false);
149 
150  void scanLibDirForGCCTripleSolaris(const llvm::Triple &TargetArch,
151  const llvm::opt::ArgList &Args,
152  const std::string &LibDir,
153  StringRef CandidateTriple,
154  bool NeedsBiarchSuffix = false);
155  };
156 
157 protected:
159 
160  // \brief A class to find a viable CUDA installation
161 
163  bool IsValid;
164  const Driver &D;
165  std::string CudaInstallPath;
166  std::string CudaLibPath;
167  std::string CudaLibDevicePath;
168  std::string CudaIncludePath;
169  llvm::StringMap<std::string> CudaLibDeviceMap;
170 
171  public:
172  CudaInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
173  void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args);
174 
175  /// \brief Check whether we detected a valid Cuda install.
176  bool isValid() const { return IsValid; }
177  /// \brief Print information about the detected CUDA installation.
178  void print(raw_ostream &OS) const;
179 
180  /// \brief Get the detected Cuda installation path.
181  StringRef getInstallPath() const { return CudaInstallPath; }
182  /// \brief Get the detected Cuda Include path.
183  StringRef getIncludePath() const { return CudaIncludePath; }
184  /// \brief Get the detected Cuda library path.
185  StringRef getLibPath() const { return CudaLibPath; }
186  /// \brief Get the detected Cuda device library path.
187  StringRef getLibDevicePath() const { return CudaLibDevicePath; }
188  /// \brief Get libdevice file for given architecture
189  std::string getLibDeviceFile(StringRef Gpu) const {
190  return CudaLibDeviceMap.lookup(Gpu);
191  }
192  };
193 
195 
196 public:
197  Generic_GCC(const Driver &D, const llvm::Triple &Triple,
198  const llvm::opt::ArgList &Args);
199  ~Generic_GCC() override;
200 
201  void printVerboseInfo(raw_ostream &OS) const override;
202 
203  bool IsUnwindTablesDefault() const override;
204  bool isPICDefault() const override;
205  bool isPIEDefault() const override;
206  bool isPICDefaultForced() const override;
207  bool IsIntegratedAssemblerDefault() const override;
208 
209 protected:
210  Tool *getTool(Action::ActionClass AC) const override;
211  Tool *buildAssembler() const override;
212  Tool *buildLinker() const override;
213 
214  /// \name ToolChain Implementation Helper Functions
215  /// @{
216 
217  /// \brief Check whether the target triple's architecture is 64-bits.
218  bool isTarget64Bit() const { return getTriple().isArch64Bit(); }
219 
220  /// \brief Check whether the target triple's architecture is 32-bits.
221  bool isTarget32Bit() const { return getTriple().isArch32Bit(); }
222 
223  bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, StringRef GCCTriple,
224  StringRef GCCMultiarchTriple,
225  StringRef TargetMultiarchTriple,
226  Twine IncludeSuffix,
227  const llvm::opt::ArgList &DriverArgs,
228  llvm::opt::ArgStringList &CC1Args) const;
229 
230  /// @}
231 
232 private:
233  mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocess;
234  mutable std::unique_ptr<tools::gcc::Compiler> Compile;
235 };
236 
237 class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
238 protected:
239  Tool *buildAssembler() const override;
240  Tool *buildLinker() const override;
241  Tool *getTool(Action::ActionClass AC) const override;
242 
243 private:
244  mutable std::unique_ptr<tools::darwin::Lipo> Lipo;
245  mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil;
246  mutable std::unique_ptr<tools::darwin::VerifyDebug> VerifyDebug;
247 
248 public:
249  MachO(const Driver &D, const llvm::Triple &Triple,
250  const llvm::opt::ArgList &Args);
251  ~MachO() override;
252 
253  /// @name MachO specific toolchain API
254  /// {
255 
256  /// Get the "MachO" arch name for a particular compiler invocation. For
257  /// example, Apple treats different ARM variations as distinct architectures.
258  StringRef getMachOArchName(const llvm::opt::ArgList &Args) const;
259 
260  /// Add the linker arguments to link the ARC runtime library.
261  virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
262  llvm::opt::ArgStringList &CmdArgs) const {}
263 
264  /// Add the linker arguments to link the compiler runtime library.
265  virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
266  llvm::opt::ArgStringList &CmdArgs) const;
267 
268  virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
269  llvm::opt::ArgStringList &CmdArgs) const {
270  }
271 
272  virtual void addMinVersionArgs(const llvm::opt::ArgList &Args,
273  llvm::opt::ArgStringList &CmdArgs) const {}
274 
275  /// On some iOS platforms, kernel and kernel modules were built statically. Is
276  /// this such a target?
277  virtual bool isKernelStatic() const { return false; }
278 
279  /// Is the target either iOS or an iOS simulator?
280  bool isTargetIOSBased() const { return false; }
281 
282  void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
283  llvm::opt::ArgStringList &CmdArgs,
284  StringRef DarwinLibName, bool AlwaysLink = false,
285  bool IsEmbedded = false, bool AddRPath = false) const;
286 
287  /// Add any profiling runtime libraries that are needed. This is essentially a
288  /// MachO specific version of addProfileRT in Tools.cpp.
289  void addProfileRTLibs(const llvm::opt::ArgList &Args,
290  llvm::opt::ArgStringList &CmdArgs) const override {
291  // There aren't any profiling libs for embedded targets currently.
292  }
293 
294  /// }
295  /// @name ToolChain Implementation
296  /// {
297 
298  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
299  types::ID InputType) const override;
300 
301  types::ID LookupTypeForExtension(const char *Ext) const override;
302 
303  bool HasNativeLLVMSupport() const override;
304 
305  llvm::opt::DerivedArgList *
306  TranslateArgs(const llvm::opt::DerivedArgList &Args,
307  const char *BoundArch) const override;
308 
309  bool IsBlocksDefault() const override {
310  // Always allow blocks on Apple; users interested in versioning are
311  // expected to use /usr/include/Block.h.
312  return true;
313  }
314  bool IsIntegratedAssemblerDefault() const override {
315  // Default integrated assembler to on for Apple's MachO targets.
316  return true;
317  }
318 
319  bool IsMathErrnoDefault() const override { return false; }
320 
321  bool IsEncodeExtendedBlockSignatureDefault() const override { return true; }
322 
323  bool IsObjCNonFragileABIDefault() const override {
324  // Non-fragile ABI is default for everything but i386.
325  return getTriple().getArch() != llvm::Triple::x86;
326  }
327 
328  bool UseObjCMixedDispatch() const override { return true; }
329 
330  bool IsUnwindTablesDefault() const override;
331 
334  }
335 
336  bool isPICDefault() const override;
337  bool isPIEDefault() const override;
338  bool isPICDefaultForced() const override;
339 
340  bool SupportsProfiling() const override;
341 
342  bool SupportsObjCGC() const override { return false; }
343 
344  bool UseDwarfDebugFlags() const override;
345 
346  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override {
347  return false;
348  }
349 
350  /// }
351 };
352 
353 /// Darwin - The base Darwin tool chain.
354 class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
355 public:
356  /// Whether the information on the target has been initialized.
357  //
358  // FIXME: This should be eliminated. What we want to do is make this part of
359  // the "default target for arguments" selection process, once we get out of
360  // the argument translation business.
361  mutable bool TargetInitialized;
362 
370  WatchOSSimulator
371  };
372 
374 
375  /// The OS version we are targeting.
377 
378 private:
379  void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
380 
381 public:
382  Darwin(const Driver &D, const llvm::Triple &Triple,
383  const llvm::opt::ArgList &Args);
384  ~Darwin() override;
385 
386  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
387  types::ID InputType) const override;
388 
389  /// @name Apple Specific Toolchain Implementation
390  /// {
391 
392  void addMinVersionArgs(const llvm::opt::ArgList &Args,
393  llvm::opt::ArgStringList &CmdArgs) const override;
394 
395  void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
396  llvm::opt::ArgStringList &CmdArgs) const override;
397 
398  bool isKernelStatic() const override {
399  return (!(isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) &&
400  !isTargetWatchOS());
401  }
402 
403  void addProfileRTLibs(const llvm::opt::ArgList &Args,
404  llvm::opt::ArgStringList &CmdArgs) const override;
405 
406 protected:
407  /// }
408  /// @name Darwin specific Toolchain functions
409  /// {
410 
411  // FIXME: Eliminate these ...Target functions and derive separate tool chains
412  // for these targets and put version in constructor.
413  void setTarget(DarwinPlatformKind Platform, unsigned Major, unsigned Minor,
414  unsigned Micro) const {
415  // FIXME: For now, allow reinitialization as long as values don't
416  // change. This will go away when we move away from argument translation.
417  if (TargetInitialized && TargetPlatform == Platform &&
418  TargetVersion == VersionTuple(Major, Minor, Micro))
419  return;
420 
421  assert(!TargetInitialized && "Target already initialized!");
422  TargetInitialized = true;
423  TargetPlatform = Platform;
424  TargetVersion = VersionTuple(Major, Minor, Micro);
425  }
426 
427  bool isTargetIPhoneOS() const {
428  assert(TargetInitialized && "Target not initialized!");
429  return TargetPlatform == IPhoneOS || TargetPlatform == TvOS;
430  }
431 
432  bool isTargetIOSSimulator() const {
433  assert(TargetInitialized && "Target not initialized!");
434  return TargetPlatform == IPhoneOSSimulator ||
435  TargetPlatform == TvOSSimulator;
436  }
437 
438  bool isTargetIOSBased() const {
439  assert(TargetInitialized && "Target not initialized!");
440  return isTargetIPhoneOS() || isTargetIOSSimulator();
441  }
442 
443  bool isTargetTvOS() const {
444  assert(TargetInitialized && "Target not initialized!");
445  return TargetPlatform == TvOS;
446  }
447 
448  bool isTargetTvOSSimulator() const {
449  assert(TargetInitialized && "Target not initialized!");
450  return TargetPlatform == TvOSSimulator;
451  }
452 
453  bool isTargetTvOSBased() const {
454  assert(TargetInitialized && "Target not initialized!");
455  return TargetPlatform == TvOS || TargetPlatform == TvOSSimulator;
456  }
457 
458  bool isTargetWatchOS() const {
459  assert(TargetInitialized && "Target not initialized!");
460  return TargetPlatform == WatchOS;
461  }
462 
464  assert(TargetInitialized && "Target not initialized!");
465  return TargetPlatform == WatchOSSimulator;
466  }
467 
468  bool isTargetWatchOSBased() const {
469  assert(TargetInitialized && "Target not initialized!");
470  return TargetPlatform == WatchOS || TargetPlatform == WatchOSSimulator;
471  }
472 
473  bool isTargetMacOS() const {
474  assert(TargetInitialized && "Target not initialized!");
475  return TargetPlatform == MacOS;
476  }
477 
478  bool isTargetInitialized() const { return TargetInitialized; }
479 
481  assert(TargetInitialized && "Target not initialized!");
482  return TargetVersion;
483  }
484 
485  bool isIPhoneOSVersionLT(unsigned V0, unsigned V1 = 0,
486  unsigned V2 = 0) const {
487  assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
488  return TargetVersion < VersionTuple(V0, V1, V2);
489  }
490 
491  bool isMacosxVersionLT(unsigned V0, unsigned V1 = 0, unsigned V2 = 0) const {
492  assert(isTargetMacOS() && "Unexpected call for non OS X target!");
493  return TargetVersion < VersionTuple(V0, V1, V2);
494  }
495 
496 public:
497  /// }
498  /// @name ToolChain Implementation
499  /// {
500 
501  // Darwin tools support multiple architecture (e.g., i386 and x86_64) and
502  // most development is done against SDKs, so compiling for a different
503  // architecture should not get any special treatment.
504  bool isCrossCompiling() const override { return false; }
505 
506  llvm::opt::DerivedArgList *
507  TranslateArgs(const llvm::opt::DerivedArgList &Args,
508  const char *BoundArch) const override;
509 
510  ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
511  bool hasBlocksRuntime() const override;
512 
513  bool UseObjCMixedDispatch() const override {
514  // This is only used with the non-fragile ABI and non-legacy dispatch.
515 
516  // Mixed dispatch is used everywhere except OS X before 10.6.
517  return !(isTargetMacOS() && isMacosxVersionLT(10, 6));
518  }
519 
520  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
521  // Stack protectors default to on for user code on 10.5,
522  // and for everything in 10.6 and beyond
523  if (isTargetIOSBased() || isTargetWatchOSBased())
524  return 1;
525  else if (isTargetMacOS() && !isMacosxVersionLT(10, 6))
526  return 1;
527  else if (isTargetMacOS() && !isMacosxVersionLT(10, 5) && !KernelOrKext)
528  return 1;
529 
530  return 0;
531  }
532 
533  bool SupportsObjCGC() const override;
534 
535  void CheckObjCARC() const override;
536 
537  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
538 
539  SanitizerMask getSupportedSanitizers() const override;
540 };
541 
542 /// DarwinClang - The Darwin toolchain used by Clang.
543 class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
544 public:
545  DarwinClang(const Driver &D, const llvm::Triple &Triple,
546  const llvm::opt::ArgList &Args);
547 
548  /// @name Apple ToolChain Implementation
549  /// {
550 
551  void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
552  llvm::opt::ArgStringList &CmdArgs) const override;
553 
554  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
555  llvm::opt::ArgStringList &CmdArgs) const override;
556 
557  void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
558  llvm::opt::ArgStringList &CmdArgs) const override;
559 
560  void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
561 
562  void AddLinkARCArgs(const llvm::opt::ArgList &Args,
563  llvm::opt::ArgStringList &CmdArgs) const override;
564 
565  unsigned GetDefaultDwarfVersion() const override { return 2; }
566  // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
567  // Darwin defaults to standalone/full debug info.
568  bool GetDefaultStandaloneDebug() const override { return true; }
569  llvm::DebuggerKind getDefaultDebuggerTuning() const override {
570  return llvm::DebuggerKind::LLDB;
571  }
572 
573  /// }
574 
575 private:
576  void AddLinkSanitizerLibArgs(const llvm::opt::ArgList &Args,
577  llvm::opt::ArgStringList &CmdArgs,
578  StringRef Sanitizer) const;
579 };
580 
581 class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC {
582  virtual void anchor();
583 
584 public:
585  Generic_ELF(const Driver &D, const llvm::Triple &Triple,
586  const llvm::opt::ArgList &Args)
587  : Generic_GCC(D, Triple, Args) {}
588 
589  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
590  llvm::opt::ArgStringList &CC1Args) const override;
591 };
592 
593 class LLVM_LIBRARY_VISIBILITY CloudABI : public Generic_ELF {
594 public:
595  CloudABI(const Driver &D, const llvm::Triple &Triple,
596  const llvm::opt::ArgList &Args);
597  bool HasNativeLLVMSupport() const override { return true; }
598 
599  bool IsMathErrnoDefault() const override { return false; }
600  bool IsObjCNonFragileABIDefault() const override { return true; }
601 
602  CXXStdlibType
603  GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
604  return ToolChain::CST_Libcxx;
605  }
606  void AddClangCXXStdlibIncludeArgs(
607  const llvm::opt::ArgList &DriverArgs,
608  llvm::opt::ArgStringList &CC1Args) const override;
609  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
610  llvm::opt::ArgStringList &CmdArgs) const override;
611 
612  bool isPIEDefault() const override { return false; }
613 
614 protected:
615  Tool *buildLinker() const override;
616 };
617 
618 class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC {
619 public:
620  Solaris(const Driver &D, const llvm::Triple &Triple,
621  const llvm::opt::ArgList &Args);
622 
623  bool IsIntegratedAssemblerDefault() const override { return true; }
624 
625  void AddClangCXXStdlibIncludeArgs(
626  const llvm::opt::ArgList &DriverArgs,
627  llvm::opt::ArgStringList &CC1Args) const override;
628 
629  unsigned GetDefaultDwarfVersion() const override { return 2; }
630 
631 protected:
632  Tool *buildAssembler() const override;
633  Tool *buildLinker() const override;
634 };
635 
636 class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain {
637 public:
638  MinGW(const Driver &D, const llvm::Triple &Triple,
639  const llvm::opt::ArgList &Args);
640 
641  bool IsIntegratedAssemblerDefault() const override;
642  bool IsUnwindTablesDefault() const override;
643  bool isPICDefault() const override;
644  bool isPIEDefault() const override;
645  bool isPICDefaultForced() const override;
646  bool UseSEHExceptions() const;
647 
648  void
649  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
650  llvm::opt::ArgStringList &CC1Args) const override;
651  void AddClangCXXStdlibIncludeArgs(
652  const llvm::opt::ArgList &DriverArgs,
653  llvm::opt::ArgStringList &CC1Args) const override;
654 
655 protected:
656  Tool *getTool(Action::ActionClass AC) const override;
657  Tool *buildLinker() const override;
658  Tool *buildAssembler() const override;
659 
660 private:
661  std::string Base;
662  std::string GccLibDir;
663  std::string Ver;
664  std::string Arch;
665  mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
666  mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
667  void findGccLibDir();
668 };
669 
670 class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
671 public:
672  OpenBSD(const Driver &D, const llvm::Triple &Triple,
673  const llvm::opt::ArgList &Args);
674 
675  bool IsMathErrnoDefault() const override { return false; }
676  bool IsObjCNonFragileABIDefault() const override { return true; }
677  bool isPIEDefault() const override { return true; }
678 
679  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
680  return 2;
681  }
682  unsigned GetDefaultDwarfVersion() const override { return 2; }
683 
684 protected:
685  Tool *buildAssembler() const override;
686  Tool *buildLinker() const override;
687 };
688 
689 class LLVM_LIBRARY_VISIBILITY Bitrig : public Generic_ELF {
690 public:
691  Bitrig(const Driver &D, const llvm::Triple &Triple,
692  const llvm::opt::ArgList &Args);
693 
694  bool IsMathErrnoDefault() const override { return false; }
695  bool IsObjCNonFragileABIDefault() const override { return true; }
696 
697  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
698  void AddClangCXXStdlibIncludeArgs(
699  const llvm::opt::ArgList &DriverArgs,
700  llvm::opt::ArgStringList &CC1Args) const override;
701  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
702  llvm::opt::ArgStringList &CmdArgs) const override;
703  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
704  return 1;
705  }
706 
707 protected:
708  Tool *buildAssembler() const override;
709  Tool *buildLinker() const override;
710 };
711 
712 class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
713 public:
714  FreeBSD(const Driver &D, const llvm::Triple &Triple,
715  const llvm::opt::ArgList &Args);
716  bool HasNativeLLVMSupport() const override;
717 
718  bool IsMathErrnoDefault() const override { return false; }
719  bool IsObjCNonFragileABIDefault() const override { return true; }
720 
721  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
722  void AddClangCXXStdlibIncludeArgs(
723  const llvm::opt::ArgList &DriverArgs,
724  llvm::opt::ArgStringList &CC1Args) const override;
725  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
726  llvm::opt::ArgStringList &CmdArgs) const override;
727 
728  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
729  bool isPIEDefault() const override;
730  SanitizerMask getSupportedSanitizers() const override;
731  unsigned GetDefaultDwarfVersion() const override { return 2; }
732  // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
733  // FreeBSD defaults to standalone/full debug info.
734  bool GetDefaultStandaloneDebug() const override { return true; }
735 
736 protected:
737  Tool *buildAssembler() const override;
738  Tool *buildLinker() const override;
739 };
740 
741 class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
742 public:
743  NetBSD(const Driver &D, const llvm::Triple &Triple,
744  const llvm::opt::ArgList &Args);
745 
746  bool IsMathErrnoDefault() const override { return false; }
747  bool IsObjCNonFragileABIDefault() const override { return true; }
748 
749  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
750 
751  void AddClangCXXStdlibIncludeArgs(
752  const llvm::opt::ArgList &DriverArgs,
753  llvm::opt::ArgStringList &CC1Args) const override;
754  bool IsUnwindTablesDefault() const override { return true; }
755 
756 protected:
757  Tool *buildAssembler() const override;
758  Tool *buildLinker() const override;
759 };
760 
761 class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF {
762 public:
763  Minix(const Driver &D, const llvm::Triple &Triple,
764  const llvm::opt::ArgList &Args);
765 
766 protected:
767  Tool *buildAssembler() const override;
768  Tool *buildLinker() const override;
769 };
770 
771 class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF {
772 public:
773  DragonFly(const Driver &D, const llvm::Triple &Triple,
774  const llvm::opt::ArgList &Args);
775 
776  bool IsMathErrnoDefault() const override { return false; }
777 
778 protected:
779  Tool *buildAssembler() const override;
780  Tool *buildLinker() const override;
781 };
782 
783 class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
784 public:
785  Linux(const Driver &D, const llvm::Triple &Triple,
786  const llvm::opt::ArgList &Args);
787 
788  bool HasNativeLLVMSupport() const override;
789 
790  void
791  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
792  llvm::opt::ArgStringList &CC1Args) const override;
793  void AddClangCXXStdlibIncludeArgs(
794  const llvm::opt::ArgList &DriverArgs,
795  llvm::opt::ArgStringList &CC1Args) const override;
796  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
797  llvm::opt::ArgStringList &CC1Args) const override;
798  bool isPIEDefault() const override;
799  SanitizerMask getSupportedSanitizers() const override;
800  void addProfileRTLibs(const llvm::opt::ArgList &Args,
801  llvm::opt::ArgStringList &CmdArgs) const override;
802  virtual std::string computeSysRoot() const;
803 
804  std::vector<std::string> ExtraOpts;
805 
806 protected:
807  Tool *buildAssembler() const override;
808  Tool *buildLinker() const override;
809 };
810 
811 class LLVM_LIBRARY_VISIBILITY CudaToolChain : public Linux {
812 public:
813  CudaToolChain(const Driver &D, const llvm::Triple &Triple,
814  const llvm::opt::ArgList &Args);
815 
816  llvm::opt::DerivedArgList *
817  TranslateArgs(const llvm::opt::DerivedArgList &Args,
818  const char *BoundArch) const override;
819  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
820  llvm::opt::ArgStringList &CC1Args) const override;
821 };
822 
823 class LLVM_LIBRARY_VISIBILITY MipsLLVMToolChain : public Linux {
824 protected:
825  Tool *buildLinker() const override;
826 
827 public:
828  MipsLLVMToolChain(const Driver &D, const llvm::Triple &Triple,
829  const llvm::opt::ArgList &Args);
830 
831  void
832  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
833  llvm::opt::ArgStringList &CC1Args) const override;
834 
835  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
836 
837  void AddClangCXXStdlibIncludeArgs(
838  const llvm::opt::ArgList &DriverArgs,
839  llvm::opt::ArgStringList &CC1Args) const override;
840 
841  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
842  llvm::opt::ArgStringList &CmdArgs) const override;
843 
844  std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
845  bool Shared = false) const override;
846 
847  std::string computeSysRoot() const override;
848 
850  return GCCInstallation.isValid() ? RuntimeLibType::RLT_Libgcc
851  : RuntimeLibType::RLT_CompilerRT;
852  }
853 
854 private:
855  Multilib SelectedMultilib;
856  std::string LibSuffix;
857 };
858 
859 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
860 protected:
862  Tool *buildAssembler() const override;
863  Tool *buildLinker() const override;
864 
865 public:
866  HexagonToolChain(const Driver &D, const llvm::Triple &Triple,
867  const llvm::opt::ArgList &Args);
868  ~HexagonToolChain() override;
869 
870  void
871  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
872  llvm::opt::ArgStringList &CC1Args) const override;
873  void AddClangCXXStdlibIncludeArgs(
874  const llvm::opt::ArgList &DriverArgs,
875  llvm::opt::ArgStringList &CC1Args) const override;
876  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
877 
878  StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
879  bool IsIntegratedAssemblerDefault() const override {
880  return true;
881  }
882 
883  std::string getHexagonTargetDir(
884  const std::string &InstalledDir,
885  const SmallVectorImpl<std::string> &PrefixDirs) const;
886  void getHexagonLibraryPaths(const llvm::opt::ArgList &Args,
887  ToolChain::path_list &LibPaths) const;
888 
889  static const StringRef GetDefaultCPU();
890  static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args);
891 
892  static Optional<unsigned> getSmallDataThreshold(
893  const llvm::opt::ArgList &Args);
894 };
895 
896 class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
897 protected:
898  Tool *buildLinker() const override;
899 
900 public:
901  AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
902  const llvm::opt::ArgList &Args);
903  bool IsIntegratedAssemblerDefault() const override { return true; }
904 };
905 
906 class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
907 public:
908  NaClToolChain(const Driver &D, const llvm::Triple &Triple,
909  const llvm::opt::ArgList &Args);
910 
911  void
912  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
913  llvm::opt::ArgStringList &CC1Args) const override;
914  void AddClangCXXStdlibIncludeArgs(
915  const llvm::opt::ArgList &DriverArgs,
916  llvm::opt::ArgStringList &CC1Args) const override;
917 
918  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
919 
920  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
921  llvm::opt::ArgStringList &CmdArgs) const override;
922 
923  bool IsIntegratedAssemblerDefault() const override {
924  return getTriple().getArch() == llvm::Triple::mipsel;
925  }
926 
927  // Get the path to the file containing NaCl's ARM macros.
928  // It lives in NaClToolChain because the ARMAssembler tool needs a
929  // const char * that it can pass around,
930  const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); }
931 
932  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
933  types::ID InputType) const override;
934 
935 protected:
936  Tool *buildLinker() const override;
937  Tool *buildAssembler() const override;
938 
939 private:
940  std::string NaClArmMacrosPath;
941 };
942 
943 /// TCEToolChain - A tool chain using the llvm bitcode tools to perform
944 /// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
945 class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain {
946 public:
947  TCEToolChain(const Driver &D, const llvm::Triple &Triple,
948  const llvm::opt::ArgList &Args);
949  ~TCEToolChain() override;
950 
951  bool IsMathErrnoDefault() const override;
952  bool isPICDefault() const override;
953  bool isPIEDefault() const override;
954  bool isPICDefaultForced() const override;
955 };
956 
957 class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain {
958 public:
959  MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
960  const llvm::opt::ArgList &Args);
961 
962  llvm::opt::DerivedArgList *
963  TranslateArgs(const llvm::opt::DerivedArgList &Args,
964  const char *BoundArch) const override;
965 
966  bool IsIntegratedAssemblerDefault() const override;
967  bool IsUnwindTablesDefault() const override;
968  bool isPICDefault() const override;
969  bool isPIEDefault() const override;
970  bool isPICDefaultForced() const override;
971 
972  void
973  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
974  llvm::opt::ArgStringList &CC1Args) const override;
975  void AddClangCXXStdlibIncludeArgs(
976  const llvm::opt::ArgList &DriverArgs,
977  llvm::opt::ArgStringList &CC1Args) const override;
978 
979  bool getWindowsSDKDir(std::string &path, int &major,
980  std::string &windowsSDKIncludeVersion,
981  std::string &windowsSDKLibVersion) const;
982  bool getWindowsSDKLibraryPath(std::string &path) const;
983  /// \brief Check if Universal CRT should be used if available
984  bool useUniversalCRT(std::string &visualStudioDir) const;
985  bool getUniversalCRTSdkDir(std::string &path, std::string &ucrtVersion) const;
986  bool getUniversalCRTLibraryPath(std::string &path) const;
987  bool getVisualStudioInstallDir(std::string &path) const;
988  bool getVisualStudioBinariesFolder(const char *clangProgramPath,
989  std::string &path) const;
990 
991  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
992  types::ID InputType) const override;
993  SanitizerMask getSupportedSanitizers() const override;
994 
995 protected:
996  void AddSystemIncludeWithSubfolder(const llvm::opt::ArgList &DriverArgs,
997  llvm::opt::ArgStringList &CC1Args,
998  const std::string &folder,
999  const Twine &subfolder1,
1000  const Twine &subfolder2 = "",
1001  const Twine &subfolder3 = "") const;
1002 
1003  Tool *buildLinker() const override;
1004  Tool *buildAssembler() const override;
1005 };
1006 
1007 class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : public Generic_GCC {
1008 public:
1009  CrossWindowsToolChain(const Driver &D, const llvm::Triple &T,
1010  const llvm::opt::ArgList &Args);
1011 
1012  bool IsIntegratedAssemblerDefault() const override { return true; }
1013  bool IsUnwindTablesDefault() const override;
1014  bool isPICDefault() const override;
1015  bool isPIEDefault() const override;
1016  bool isPICDefaultForced() const override;
1017 
1018  unsigned int GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
1019  return 0;
1020  }
1021 
1022  void
1023  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
1024  llvm::opt::ArgStringList &CC1Args) const override;
1025  void AddClangCXXStdlibIncludeArgs(
1026  const llvm::opt::ArgList &DriverArgs,
1027  llvm::opt::ArgStringList &CC1Args) const override;
1028  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
1029  llvm::opt::ArgStringList &CmdArgs) const override;
1030 
1031  SanitizerMask getSupportedSanitizers() const override;
1032 
1033 protected:
1034  Tool *buildLinker() const override;
1035  Tool *buildAssembler() const override;
1036 };
1037 
1038 class LLVM_LIBRARY_VISIBILITY XCoreToolChain : public ToolChain {
1039 public:
1040  XCoreToolChain(const Driver &D, const llvm::Triple &Triple,
1041  const llvm::opt::ArgList &Args);
1042 
1043 protected:
1044  Tool *buildAssembler() const override;
1045  Tool *buildLinker() const override;
1046 
1047 public:
1048  bool isPICDefault() const override;
1049  bool isPIEDefault() const override;
1050  bool isPICDefaultForced() const override;
1051  bool SupportsProfiling() const override;
1052  bool hasBlocksRuntime() const override;
1053  void
1054  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
1055  llvm::opt::ArgStringList &CC1Args) const override;
1056  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
1057  llvm::opt::ArgStringList &CC1Args) const override;
1058  void AddClangCXXStdlibIncludeArgs(
1059  const llvm::opt::ArgList &DriverArgs,
1060  llvm::opt::ArgStringList &CC1Args) const override;
1061  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
1062  llvm::opt::ArgStringList &CmdArgs) const override;
1063 };
1064 
1065 /// MyriadToolChain - A tool chain using either clang or the external compiler
1066 /// installed by the Movidius SDK to perform all subcommands.
1067 class LLVM_LIBRARY_VISIBILITY MyriadToolChain : public Generic_GCC {
1068 public:
1069  MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
1070  const llvm::opt::ArgList &Args);
1071  ~MyriadToolChain() override;
1072 
1073  void
1074  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
1075  llvm::opt::ArgStringList &CC1Args) const override;
1076  void AddClangCXXStdlibIncludeArgs(
1077  const llvm::opt::ArgList &DriverArgs,
1078  llvm::opt::ArgStringList &CC1Args) const override;
1079  Tool *SelectTool(const JobAction &JA) const override;
1080  unsigned GetDefaultDwarfVersion() const override { return 2; }
1081 
1082 protected:
1083  Tool *buildLinker() const override;
1084  bool isShaveCompilation(const llvm::Triple &T) const {
1085  return T.getArch() == llvm::Triple::shave;
1086  }
1087 
1088 private:
1089  mutable std::unique_ptr<Tool> Compiler;
1090  mutable std::unique_ptr<Tool> Assembler;
1091 };
1092 
1093 class LLVM_LIBRARY_VISIBILITY WebAssembly final : public ToolChain {
1094 public:
1095  WebAssembly(const Driver &D, const llvm::Triple &Triple,
1096  const llvm::opt::ArgList &Args);
1097 
1098 private:
1099  bool IsMathErrnoDefault() const override;
1100  bool IsObjCNonFragileABIDefault() const override;
1101  bool UseObjCMixedDispatch() const override;
1102  bool isPICDefault() const override;
1103  bool isPIEDefault() const override;
1104  bool isPICDefaultForced() const override;
1105  bool IsIntegratedAssemblerDefault() const override;
1106  bool hasBlocksRuntime() const override;
1107  bool SupportsObjCGC() const override;
1108  bool SupportsProfiling() const override;
1109  bool HasNativeLLVMSupport() const override;
1110  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
1111  llvm::opt::ArgStringList &CC1Args) const override;
1112 
1113  Tool *buildLinker() const override;
1114 };
1115 
1116 class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
1117 public:
1118  PS4CPU(const Driver &D, const llvm::Triple &Triple,
1119  const llvm::opt::ArgList &Args);
1120 
1121  bool IsMathErrnoDefault() const override { return false; }
1122  bool IsObjCNonFragileABIDefault() const override { return true; }
1123  bool HasNativeLLVMSupport() const override;
1124  bool isPICDefault() const override;
1125 
1126  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
1127  return 2; // SSPStrong
1128  }
1129 
1130  llvm::DebuggerKind getDefaultDebuggerTuning() const override {
1131  return llvm::DebuggerKind::SCE;
1132  }
1133 
1134  SanitizerMask getSupportedSanitizers() const override;
1135 
1136 protected:
1137  Tool *buildAssembler() const override;
1138  Tool *buildLinker() const override;
1139 };
1140 
1141 } // end namespace toolchains
1142 } // end namespace driver
1143 } // end namespace clang
1144 
1145 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_H
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:599
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: ToolChains.h:612
unsigned GetDefaultDwarfVersion() const override
Definition: ToolChains.h:629
bool IsEncodeExtendedBlockSignatureDefault() const override
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChains.h:321
DarwinClang - The Darwin toolchain used by Clang.
Definition: ToolChains.h:543
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChains.h:520
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:776
Generic_GCC - A tool chain using the 'gcc' command to perform all subcommands; this relies on gcc tra...
Definition: ToolChains.h:31
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:694
bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override
UseSjLjExceptions - Does this tool chain use SjLj exceptions.
Definition: ToolChains.h:346
SmallString< 128 > getCompilerRT(const ToolChain &TC, const llvm::opt::ArgList &Args, StringRef Component, bool Shared=false)
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChains.h:332
unsigned int GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChains.h:1018
bool isCrossCompiling() const override
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChains.h:504
Struct to store and manipulate GCC versions.
Definition: ToolChains.h:48
MyriadToolChain - A tool chain using either clang or the external compiler installed by the Movidius ...
Definition: ToolChains.h:1067
StringRef getInstallPath() const
Get the detected GCC installation path.
Definition: ToolChains.h:114
bool operator<=(const GCCVersion &RHS) const
Definition: ToolChains.h:68
bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const
Definition: ToolChains.h:485
bool IsBlocksDefault() const override
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChains.h:309
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:675
unsigned GetDefaultDwarfVersion() const override
Definition: ToolChains.h:731
std::string PatchSuffix
Any textual suffix on the patch number.
Definition: ToolChains.h:59
unsigned GetDefaultDwarfVersion() const override
Definition: ToolChains.h:1080
bool TargetInitialized
Whether the information on the target has been initialized.
Definition: ToolChains.h:361
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChains.h:1126
const llvm::Triple & getTriple() const
Get the GCC triple for the detected install.
Definition: ToolChains.h:111
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:600
GCCInstallationDetector GCCInstallation
Definition: ToolChains.h:158
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:676
void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override
Add any profiling runtime libraries that are needed.
Definition: ToolChains.h:289
virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Definition: ToolChains.h:268
Darwin - The base Darwin tool chain.
Definition: ToolChains.h:354
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChains.h:849
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:923
StringRef getInstallPath() const
Get the detected Cuda installation path.
Definition: ToolChains.h:181
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:623
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:319
bool isValid() const
Check whether we detected a valid Cuda install.
Definition: ToolChains.h:176
const Multilib & getMultilib() const
Get the detected Multilib.
Definition: ToolChains.h:120
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChains.h:679
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:65
const char * GetNaClArmMacrosPath() const
Definition: ToolChains.h:930
std::string getLibDeviceFile(StringRef Gpu) const
Get libdevice file for given architecture.
Definition: ToolChains.h:189
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:695
const MultilibSet & getMultilibs() const
Get the whole MultilibSet.
Definition: ToolChains.h:123
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: ToolChains.h:569
CudaInstallationDetector CudaInstallation
Definition: ToolChains.h:194
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: ToolChains.h:1130
StringRef getLibDevicePath() const
Get the detected Cuda device library path.
Definition: ToolChains.h:187
bool SupportsObjCGC() const override
Does this tool chain support Objective-C garbage collection.
Definition: ToolChains.h:342
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:879
bool isValid() const
Check whether we detected a valid GCC install.
Definition: ToolChains.h:108
VersionTuple getTargetVersion() const
Definition: ToolChains.h:480
VersionTuple TargetVersion
The OS version we are targeting.
Definition: ToolChains.h:376
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: ToolChains.h:603
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag...
Definition: Multilib.h:26
bool IsUnwindTablesDefault() const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: ToolChains.h:754
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:718
bool GetDefaultStandaloneDebug() const override
Definition: ToolChains.h:734
virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Add the linker arguments to link the ARC runtime library.
Definition: ToolChains.h:261
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChains.h:513
void setTarget(DarwinPlatformKind Platform, unsigned Major, unsigned Minor, unsigned Micro) const
Definition: ToolChains.h:413
#define false
Definition: stdbool.h:33
bool isKernelStatic() const override
On some iOS platforms, kernel and kernel modules were built statically.
Definition: ToolChains.h:398
bool isTargetIOSBased() const
Is the target either iOS or an iOS simulator?
Definition: ToolChains.h:280
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: ToolChains.h:597
This is a class to find a viable GCC installation for Clang to use.
Definition: ToolChains.h:78
TCEToolChain - A tool chain using the llvm bitcode tools to perform all subcommands.
Definition: ToolChains.h:945
bool operator>=(const GCCVersion &RHS) const
Definition: ToolChains.h:69
bool isTarget32Bit() const
Check whether the target triple's architecture is 32-bits.
Definition: ToolChains.h:221
unsigned GetDefaultDwarfVersion() const override
Definition: ToolChains.h:565
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: ToolChains.h:703
virtual bool isKernelStatic() const
On some iOS platforms, kernel and kernel modules were built statically.
Definition: ToolChains.h:277
StringRef getLibPath() const
Get the detected Cuda library path.
Definition: ToolChains.h:185
DarwinPlatformKind TargetPlatform
Definition: ToolChains.h:373
uint64_t SanitizerMask
Definition: Sanitizers.h:24
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:323
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:1122
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:25
bool GetDefaultStandaloneDebug() const override
Definition: ToolChains.h:568
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
virtual void addMinVersionArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Definition: ToolChains.h:272
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:903
bool operator>(const GCCVersion &RHS) const
Definition: ToolChains.h:67
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:314
StringRef getIncludePath() const
Get the detected Cuda Include path.
Definition: ToolChains.h:183
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:1121
std::string Text
The unparsed text of the version.
Definition: ToolChains.h:50
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChains.h:746
bool isTarget64Bit() const
Check whether the target triple's architecture is 64-bits.
Definition: ToolChains.h:218
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChains.h:1012
const GCCVersion & getVersion() const
Get the detected GCC version string.
Definition: ToolChains.h:130
bool isShaveCompilation(const llvm::Triple &T) const
Definition: ToolChains.h:1084
Generic_ELF(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Definition: ToolChains.h:585
bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const
Definition: ToolChains.h:491
bool operator<(const GCCVersion &RHS) const
Definition: ToolChains.h:64
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: ToolChains.h:677
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
bool isTargetWatchOSSimulator() const
Definition: ToolChains.h:463
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:747
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChains.h:328
std::vector< std::string > ExtraOpts
Definition: ToolChains.h:804
int Major
The parsed major, minor, and patch numbers.
Definition: ToolChains.h:53
StringRef getParentLibPath() const
Get the detected GCC parent lib path.
Definition: ToolChains.h:117
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChains.h:719
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:96
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:47
unsigned GetDefaultDwarfVersion() const override
Definition: ToolChains.h:682