Home | History | Annotate | Download | only in Driver
      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 CLANG_LIB_DRIVER_TOOLCHAINS_H_
     11 #define CLANG_LIB_DRIVER_TOOLCHAINS_H_
     12 
     13 #include "Tools.h"
     14 #include "clang/Basic/VersionTuple.h"
     15 #include "clang/Driver/Action.h"
     16 #include "clang/Driver/ToolChain.h"
     17 #include "llvm/ADT/DenseMap.h"
     18 #include "llvm/Support/Compiler.h"
     19 
     20 #include <vector>
     21 
     22 namespace clang {
     23 namespace driver {
     24 namespace toolchains {
     25 
     26 /// Generic_GCC - A tool chain using the 'gcc' command to perform
     27 /// all subcommands; this relies on gcc translating the majority of
     28 /// command line options.
     29 class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain {
     30 protected:
     31   /// \brief Struct to store and manipulate GCC versions.
     32   ///
     33   /// We rely on assumptions about the form and structure of GCC version
     34   /// numbers: they consist of at most three '.'-separated components, and each
     35   /// component is a non-negative integer except for the last component. For
     36   /// the last component we are very flexible in order to tolerate release
     37   /// candidates or 'x' wildcards.
     38   ///
     39   /// Note that the ordering established among GCCVersions is based on the
     40   /// preferred version string to use. For example we prefer versions without
     41   /// a hard-coded patch number to those with a hard coded patch number.
     42   ///
     43   /// Currently this doesn't provide any logic for textual suffixes to patches
     44   /// in the way that (for example) Debian's version format does. If that ever
     45   /// becomes necessary, it can be added.
     46   struct GCCVersion {
     47     /// \brief The unparsed text of the version.
     48     std::string Text;
     49 
     50     /// \brief The parsed major, minor, and patch numbers.
     51     int Major, Minor, Patch;
     52 
     53     /// \brief Any textual suffix on the patch number.
     54     std::string PatchSuffix;
     55 
     56     static GCCVersion Parse(StringRef VersionText);
     57     bool operator<(const GCCVersion &RHS) const;
     58     bool operator>(const GCCVersion &RHS) const { return RHS < *this; }
     59     bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); }
     60     bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); }
     61   };
     62 
     63 
     64   /// \brief This is a class to find a viable GCC installation for Clang to
     65   /// use.
     66   ///
     67   /// This class tries to find a GCC installation on the system, and report
     68   /// information about it. It starts from the host information provided to the
     69   /// Driver, and has logic for fuzzing that where appropriate.
     70   class GCCInstallationDetector {
     71     bool IsValid;
     72     llvm::Triple GCCTriple;
     73 
     74     // FIXME: These might be better as path objects.
     75     std::string GCCInstallPath;
     76     std::string GCCBiarchSuffix;
     77     std::string GCCParentLibPath;
     78 
     79     GCCVersion Version;
     80 
     81     // We retain the list of install paths that were considered and rejected in
     82     // order to print out detailed information in verbose mode.
     83     SmallVector<std::string, 4> CandidateGCCInstallPaths;
     84 
     85   public:
     86     GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,
     87                             const llvm::opt::ArgList &Args);
     88 
     89     /// \brief Check whether we detected a valid GCC install.
     90     bool isValid() const { return IsValid; }
     91 
     92     /// \brief Get the GCC triple for the detected install.
     93     const llvm::Triple &getTriple() const { return GCCTriple; }
     94 
     95     /// \brief Get the detected GCC installation path.
     96     StringRef getInstallPath() const { return GCCInstallPath; }
     97 
     98     /// \brief Get the detected GCC installation path suffix for the bi-arch
     99     /// target variant.
    100     StringRef getBiarchSuffix() const { return GCCBiarchSuffix; }
    101 
    102     /// \brief Get the detected GCC parent lib path.
    103     StringRef getParentLibPath() const { return GCCParentLibPath; }
    104 
    105     /// \brief Get the detected GCC version string.
    106     const GCCVersion &getVersion() const { return Version; }
    107 
    108     /// \brief Print information about the detected GCC installation.
    109     void print(raw_ostream &OS) const;
    110 
    111   private:
    112     static void
    113     CollectLibDirsAndTriples(const llvm::Triple &TargetTriple,
    114                              const llvm::Triple &BiarchTriple,
    115                              SmallVectorImpl<StringRef> &LibDirs,
    116                              SmallVectorImpl<StringRef> &TripleAliases,
    117                              SmallVectorImpl<StringRef> &BiarchLibDirs,
    118                              SmallVectorImpl<StringRef> &BiarchTripleAliases);
    119 
    120     void ScanLibDirForGCCTriple(llvm::Triple::ArchType TargetArch,
    121                                 const llvm::opt::ArgList &Args,
    122                                 const std::string &LibDir,
    123                                 StringRef CandidateTriple,
    124                                 bool NeedsBiarchSuffix = false);
    125   };
    126 
    127   GCCInstallationDetector GCCInstallation;
    128 
    129 public:
    130   Generic_GCC(const Driver &D, const llvm::Triple &Triple,
    131               const llvm::opt::ArgList &Args);
    132   ~Generic_GCC();
    133 
    134   virtual void printVerboseInfo(raw_ostream &OS) const;
    135 
    136   virtual bool IsUnwindTablesDefault() const;
    137   virtual bool isPICDefault() const;
    138   virtual bool isPIEDefault() const;
    139   virtual bool isPICDefaultForced() const;
    140 
    141 protected:
    142   virtual Tool *getTool(Action::ActionClass AC) const;
    143   virtual Tool *buildAssembler() const;
    144   virtual Tool *buildLinker() const;
    145 
    146   /// \name ToolChain Implementation Helper Functions
    147   /// @{
    148 
    149   /// \brief Check whether the target triple's architecture is 64-bits.
    150   bool isTarget64Bit() const { return getTriple().isArch64Bit(); }
    151 
    152   /// \brief Check whether the target triple's architecture is 32-bits.
    153   bool isTarget32Bit() const { return getTriple().isArch32Bit(); }
    154 
    155   /// @}
    156 
    157 private:
    158   mutable OwningPtr<tools::gcc::Preprocess> Preprocess;
    159   mutable OwningPtr<tools::gcc::Precompile> Precompile;
    160   mutable OwningPtr<tools::gcc::Compile> Compile;
    161 };
    162 
    163   /// Darwin - The base Darwin tool chain.
    164 class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain {
    165 public:
    166   /// The host version.
    167   unsigned DarwinVersion[3];
    168 
    169 protected:
    170   virtual Tool *buildAssembler() const;
    171   virtual Tool *buildLinker() const;
    172   virtual Tool *getTool(Action::ActionClass AC) const;
    173 
    174 private:
    175   mutable OwningPtr<tools::darwin::Lipo> Lipo;
    176   mutable OwningPtr<tools::darwin::Dsymutil> Dsymutil;
    177   mutable OwningPtr<tools::darwin::VerifyDebug> VerifyDebug;
    178 
    179   /// Whether the information on the target has been initialized.
    180   //
    181   // FIXME: This should be eliminated. What we want to do is make this part of
    182   // the "default target for arguments" selection process, once we get out of
    183   // the argument translation business.
    184   mutable bool TargetInitialized;
    185 
    186   /// Whether we are targeting iPhoneOS target.
    187   mutable bool TargetIsIPhoneOS;
    188 
    189   /// Whether we are targeting the iPhoneOS simulator target.
    190   mutable bool TargetIsIPhoneOSSimulator;
    191 
    192   /// The OS version we are targeting.
    193   mutable VersionTuple TargetVersion;
    194 
    195 private:
    196   /// The default macosx-version-min of this tool chain; empty until
    197   /// initialized.
    198   std::string MacosxVersionMin;
    199 
    200   /// The default ios-version-min of this tool chain; empty until
    201   /// initialized.
    202   std::string iOSVersionMin;
    203 
    204 private:
    205   void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
    206 
    207 public:
    208   Darwin(const Driver &D, const llvm::Triple &Triple,
    209          const llvm::opt::ArgList &Args);
    210   ~Darwin();
    211 
    212   std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
    213                                           types::ID InputType) const;
    214 
    215   /// @name Darwin Specific Toolchain API
    216   /// {
    217 
    218   // FIXME: Eliminate these ...Target functions and derive separate tool chains
    219   // for these targets and put version in constructor.
    220   void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor,
    221                  unsigned Micro, bool IsIOSSim) const {
    222     assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!");
    223 
    224     // FIXME: For now, allow reinitialization as long as values don't
    225     // change. This will go away when we move away from argument translation.
    226     if (TargetInitialized && TargetIsIPhoneOS == IsIPhoneOS &&
    227         TargetIsIPhoneOSSimulator == IsIOSSim &&
    228         TargetVersion == VersionTuple(Major, Minor, Micro))
    229       return;
    230 
    231     assert(!TargetInitialized && "Target already initialized!");
    232     TargetInitialized = true;
    233     TargetIsIPhoneOS = IsIPhoneOS;
    234     TargetIsIPhoneOSSimulator = IsIOSSim;
    235     TargetVersion = VersionTuple(Major, Minor, Micro);
    236   }
    237 
    238   bool isTargetIPhoneOS() const {
    239     assert(TargetInitialized && "Target not initialized!");
    240     return TargetIsIPhoneOS;
    241   }
    242 
    243   bool isTargetIOSSimulator() const {
    244     assert(TargetInitialized && "Target not initialized!");
    245     return TargetIsIPhoneOSSimulator;
    246   }
    247 
    248   bool isTargetMacOS() const {
    249     return !isTargetIOSSimulator() && !isTargetIPhoneOS();
    250   }
    251 
    252   bool isTargetInitialized() const { return TargetInitialized; }
    253 
    254   VersionTuple getTargetVersion() const {
    255     assert(TargetInitialized && "Target not initialized!");
    256     return TargetVersion;
    257   }
    258 
    259   /// getDarwinArchName - Get the "Darwin" arch name for a particular compiler
    260   /// invocation. For example, Darwin treats different ARM variations as
    261   /// distinct architectures.
    262   StringRef getDarwinArchName(const llvm::opt::ArgList &Args) const;
    263 
    264   bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const {
    265     assert(isTargetIPhoneOS() && "Unexpected call for OS X target!");
    266     return TargetVersion < VersionTuple(V0, V1, V2);
    267   }
    268 
    269   bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const {
    270     assert(!isTargetIPhoneOS() && "Unexpected call for iPhoneOS target!");
    271     return TargetVersion < VersionTuple(V0, V1, V2);
    272   }
    273 
    274   /// AddLinkARCArgs - Add the linker arguments to link the ARC runtime library.
    275   virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
    276                               llvm::opt::ArgStringList &CmdArgs) const = 0;
    277 
    278   /// AddLinkRuntimeLibArgs - Add the linker arguments to link the compiler
    279   /// runtime library.
    280   virtual void
    281   AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
    282                         llvm::opt::ArgStringList &CmdArgs) const = 0;
    283 
    284   /// }
    285   /// @name ToolChain Implementation
    286   /// {
    287 
    288   virtual types::ID LookupTypeForExtension(const char *Ext) const;
    289 
    290   virtual bool HasNativeLLVMSupport() const;
    291 
    292   virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
    293   virtual bool hasBlocksRuntime() const;
    294 
    295   virtual llvm::opt::DerivedArgList *
    296   TranslateArgs(const llvm::opt::DerivedArgList &Args,
    297                 const char *BoundArch) const;
    298 
    299   virtual bool IsBlocksDefault() const {
    300     // Always allow blocks on Darwin; users interested in versioning are
    301     // expected to use /usr/include/Blocks.h.
    302     return true;
    303   }
    304   virtual bool IsIntegratedAssemblerDefault() const {
    305 #ifdef DISABLE_DEFAULT_INTEGRATED_ASSEMBLER
    306     return false;
    307 #else
    308     // Default integrated assembler to on for Darwin.
    309     return true;
    310 #endif
    311   }
    312   virtual bool IsStrictAliasingDefault() const {
    313 #ifdef DISABLE_DEFAULT_STRICT_ALIASING
    314     return false;
    315 #else
    316     return ToolChain::IsStrictAliasingDefault();
    317 #endif
    318   }
    319 
    320   virtual bool IsMathErrnoDefault() const {
    321     return false;
    322   }
    323 
    324   virtual bool IsEncodeExtendedBlockSignatureDefault() const {
    325     return true;
    326   }
    327 
    328   virtual bool IsObjCNonFragileABIDefault() const {
    329     // Non-fragile ABI is default for everything but i386.
    330     return getTriple().getArch() != llvm::Triple::x86;
    331   }
    332 
    333   virtual bool UseObjCMixedDispatch() const {
    334     // This is only used with the non-fragile ABI and non-legacy dispatch.
    335 
    336     // Mixed dispatch is used everywhere except OS X before 10.6.
    337     return !(!isTargetIPhoneOS() && isMacosxVersionLT(10, 6));
    338   }
    339   virtual bool IsUnwindTablesDefault() const;
    340   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
    341     // Stack protectors default to on for user code on 10.5,
    342     // and for everything in 10.6 and beyond
    343     return isTargetIPhoneOS() ||
    344       (!isMacosxVersionLT(10, 6) ||
    345          (!isMacosxVersionLT(10, 5) && !KernelOrKext));
    346   }
    347   virtual RuntimeLibType GetDefaultRuntimeLibType() const {
    348     return ToolChain::RLT_CompilerRT;
    349   }
    350   virtual bool isPICDefault() const;
    351   virtual bool isPIEDefault() const;
    352   virtual bool isPICDefaultForced() const;
    353 
    354   virtual bool SupportsProfiling() const;
    355 
    356   virtual bool SupportsObjCGC() const;
    357 
    358   virtual void CheckObjCARC() const;
    359 
    360   virtual bool UseDwarfDebugFlags() const;
    361 
    362   virtual bool UseSjLjExceptions() const;
    363 
    364   /// }
    365 };
    366 
    367 /// DarwinClang - The Darwin toolchain used by Clang.
    368 class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
    369 public:
    370   DarwinClang(const Driver &D, const llvm::Triple &Triple,
    371               const llvm::opt::ArgList &Args);
    372 
    373   /// @name Darwin ToolChain Implementation
    374   /// {
    375 
    376   virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
    377                                      llvm::opt::ArgStringList &CmdArgs) const;
    378   void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
    379                          llvm::opt::ArgStringList &CmdArgs,
    380                          const char *DarwinStaticLib,
    381                          bool AlwaysLink = false) const;
    382 
    383   virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
    384                                    llvm::opt::ArgStringList &CmdArgs) const;
    385 
    386   virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
    387                                 llvm::opt::ArgStringList &CmdArgs) const;
    388 
    389   virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
    390                               llvm::opt::ArgStringList &CmdArgs) const;
    391   /// }
    392 };
    393 
    394 /// Darwin_Generic_GCC - Generic Darwin tool chain using gcc.
    395 class LLVM_LIBRARY_VISIBILITY Darwin_Generic_GCC : public Generic_GCC {
    396 public:
    397   Darwin_Generic_GCC(const Driver &D, const llvm::Triple &Triple,
    398                      const llvm::opt::ArgList &Args)
    399       : Generic_GCC(D, Triple, Args) {}
    400 
    401   std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
    402                                           types::ID InputType) const;
    403 
    404   virtual bool isPICDefault() const { return false; }
    405 };
    406 
    407 class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC {
    408   virtual void anchor();
    409 public:
    410   Generic_ELF(const Driver &D, const llvm::Triple &Triple,
    411               const llvm::opt::ArgList &Args)
    412       : Generic_GCC(D, Triple, Args) {}
    413 
    414   virtual bool IsIntegratedAssemblerDefault() const {
    415     // Default integrated assembler to on for x86.
    416     return (getTriple().getArch() == llvm::Triple::aarch64 ||
    417             getTriple().getArch() == llvm::Triple::x86 ||
    418             getTriple().getArch() == llvm::Triple::x86_64);
    419   }
    420 };
    421 
    422 class LLVM_LIBRARY_VISIBILITY AuroraUX : public Generic_GCC {
    423 public:
    424   AuroraUX(const Driver &D, const llvm::Triple &Triple,
    425            const llvm::opt::ArgList &Args);
    426 
    427 protected:
    428   virtual Tool *buildAssembler() const;
    429   virtual Tool *buildLinker() const;
    430 };
    431 
    432 class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC {
    433 public:
    434   Solaris(const Driver &D, const llvm::Triple &Triple,
    435           const llvm::opt::ArgList &Args);
    436 
    437   virtual bool IsIntegratedAssemblerDefault() const { return true; }
    438 protected:
    439   virtual Tool *buildAssembler() const;
    440   virtual Tool *buildLinker() const;
    441 
    442 };
    443 
    444 
    445 class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
    446 public:
    447   OpenBSD(const Driver &D, const llvm::Triple &Triple,
    448           const llvm::opt::ArgList &Args);
    449 
    450   virtual bool IsMathErrnoDefault() const { return false; }
    451   virtual bool IsObjCNonFragileABIDefault() const { return true; }
    452   virtual bool isPIEDefault() const { return true; }
    453 
    454   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
    455     return 1;
    456   }
    457 
    458 protected:
    459   virtual Tool *buildAssembler() const;
    460   virtual Tool *buildLinker() const;
    461 };
    462 
    463 class LLVM_LIBRARY_VISIBILITY Bitrig : public Generic_ELF {
    464 public:
    465   Bitrig(const Driver &D, const llvm::Triple &Triple,
    466          const llvm::opt::ArgList &Args);
    467 
    468   virtual bool IsMathErrnoDefault() const { return false; }
    469   virtual bool IsObjCNonFragileABIDefault() const { return true; }
    470   virtual bool IsObjCLegacyDispatchDefault() const { return false; }
    471 
    472   virtual void
    473   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    474                                llvm::opt::ArgStringList &CC1Args) const;
    475   virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
    476                                    llvm::opt::ArgStringList &CmdArgs) const;
    477   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
    478      return 1;
    479   }
    480 
    481 protected:
    482   virtual Tool *buildAssembler() const;
    483   virtual Tool *buildLinker() const;
    484 };
    485 
    486 class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
    487 public:
    488   FreeBSD(const Driver &D, const llvm::Triple &Triple,
    489           const llvm::opt::ArgList &Args);
    490 
    491   virtual bool IsMathErrnoDefault() const { return false; }
    492   virtual bool IsObjCNonFragileABIDefault() const { return true; }
    493 
    494   virtual bool UseSjLjExceptions() const;
    495 protected:
    496   virtual Tool *buildAssembler() const;
    497   virtual Tool *buildLinker() const;
    498 };
    499 
    500 class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
    501 public:
    502   NetBSD(const Driver &D, const llvm::Triple &Triple,
    503          const llvm::opt::ArgList &Args);
    504 
    505   virtual bool IsMathErrnoDefault() const { return false; }
    506   virtual bool IsObjCNonFragileABIDefault() const { return true; }
    507 
    508   virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
    509 
    510   virtual void
    511   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    512                                llvm::opt::ArgStringList &CC1Args) const;
    513 
    514 protected:
    515   virtual Tool *buildAssembler() const;
    516   virtual Tool *buildLinker() const;
    517 };
    518 
    519 class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF {
    520 public:
    521   Minix(const Driver &D, const llvm::Triple &Triple,
    522         const llvm::opt::ArgList &Args);
    523 
    524 protected:
    525   virtual Tool *buildAssembler() const;
    526   virtual Tool *buildLinker() const;
    527 };
    528 
    529 class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF {
    530 public:
    531   DragonFly(const Driver &D, const llvm::Triple &Triple,
    532             const llvm::opt::ArgList &Args);
    533 
    534   virtual bool IsMathErrnoDefault() const { return false; }
    535 
    536 protected:
    537   virtual Tool *buildAssembler() const;
    538   virtual Tool *buildLinker() const;
    539 };
    540 
    541 class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
    542 public:
    543   Linux(const Driver &D, const llvm::Triple &Triple,
    544         const llvm::opt::ArgList &Args);
    545 
    546   virtual bool HasNativeLLVMSupport() const;
    547 
    548   virtual void
    549   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    550                             llvm::opt::ArgStringList &CC1Args) const;
    551   virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
    552                                      llvm::opt::ArgStringList &CC1Args) const;
    553   virtual void
    554   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    555                                llvm::opt::ArgStringList &CC1Args) const;
    556   virtual bool isPIEDefault() const;
    557 
    558   std::string Linker;
    559   std::vector<std::string> ExtraOpts;
    560   bool IsPIEDefault;
    561 
    562 protected:
    563   virtual Tool *buildAssembler() const;
    564   virtual Tool *buildLinker() const;
    565 
    566 private:
    567   static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
    568                                        Twine TargetArchDir,
    569                                        Twine MultiLibSuffix,
    570                                        const llvm::opt::ArgList &DriverArgs,
    571                                        llvm::opt::ArgStringList &CC1Args);
    572   static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
    573                                        const llvm::opt::ArgList &DriverArgs,
    574                                        llvm::opt::ArgStringList &CC1Args);
    575 
    576   std::string computeSysRoot(const llvm::opt::ArgList &Args) const;
    577 };
    578 
    579 class LLVM_LIBRARY_VISIBILITY Hexagon_TC : public Linux {
    580 protected:
    581   GCCVersion GCCLibAndIncVersion;
    582   virtual Tool *buildAssembler() const;
    583   virtual Tool *buildLinker() const;
    584 
    585 public:
    586   Hexagon_TC(const Driver &D, const llvm::Triple &Triple,
    587              const llvm::opt::ArgList &Args);
    588   ~Hexagon_TC();
    589 
    590   virtual void
    591   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    592                             llvm::opt::ArgStringList &CC1Args) const;
    593   virtual void
    594   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    595                                llvm::opt::ArgStringList &CC1Args) const;
    596   virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
    597 
    598   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
    599 
    600   static std::string GetGnuDir(const std::string &InstalledDir);
    601 
    602   static StringRef GetTargetCPU(const llvm::opt::ArgList &Args);
    603 };
    604 
    605 /// TCEToolChain - A tool chain using the llvm bitcode tools to perform
    606 /// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
    607 class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain {
    608 public:
    609   TCEToolChain(const Driver &D, const llvm::Triple &Triple,
    610                const llvm::opt::ArgList &Args);
    611   ~TCEToolChain();
    612 
    613   bool IsMathErrnoDefault() const;
    614   bool isPICDefault() const;
    615   bool isPIEDefault() const;
    616   bool isPICDefaultForced() const;
    617 };
    618 
    619 class LLVM_LIBRARY_VISIBILITY Windows : public ToolChain {
    620 public:
    621   Windows(const Driver &D, const llvm::Triple &Triple,
    622           const llvm::opt::ArgList &Args);
    623 
    624   virtual bool IsIntegratedAssemblerDefault() const;
    625   virtual bool IsUnwindTablesDefault() const;
    626   virtual bool isPICDefault() const;
    627   virtual bool isPIEDefault() const;
    628   virtual bool isPICDefaultForced() const;
    629 
    630   virtual void
    631   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    632                             llvm::opt::ArgStringList &CC1Args) const;
    633   virtual void
    634   AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
    635                                llvm::opt::ArgStringList &CC1Args) const;
    636 
    637 protected:
    638   virtual Tool *buildLinker() const;
    639   virtual Tool *buildAssembler() const;
    640 };
    641 
    642 } // end namespace toolchains
    643 } // end namespace driver
    644 } // end namespace clang
    645 
    646 #endif
    647