clang API Documentation

Tools.h
Go to the documentation of this file.
00001 //===--- Tools.h - Tool Implementations -------------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLS_H
00011 #define LLVM_CLANG_LIB_DRIVER_TOOLS_H
00012 
00013 #include "clang/Driver/Tool.h"
00014 #include "clang/Driver/Types.h"
00015 #include "clang/Driver/Util.h"
00016 #include "llvm/ADT/Triple.h"
00017 #include "llvm/Option/Option.h"
00018 #include "llvm/Support/Compiler.h"
00019 
00020 namespace clang {
00021   class ObjCRuntime;
00022 
00023 namespace driver {
00024   class Command;
00025   class Driver;
00026 
00027 namespace toolchains {
00028   class MachO;
00029 }
00030 
00031 namespace tools {
00032 
00033 namespace visualstudio {
00034   class Compile;
00035 }
00036 
00037 using llvm::opt::ArgStringList;
00038 
00039   /// \brief Clang compiler tool.
00040   class LLVM_LIBRARY_VISIBILITY Clang : public Tool {
00041   public:
00042     static const char *getBaseInputName(const llvm::opt::ArgList &Args,
00043                                         const InputInfoList &Inputs);
00044     static const char *getBaseInputStem(const llvm::opt::ArgList &Args,
00045                                         const InputInfoList &Inputs);
00046     static const char *getDependencyFileName(const llvm::opt::ArgList &Args,
00047                                              const InputInfoList &Inputs);
00048 
00049   private:
00050     void AddPreprocessingOptions(Compilation &C, const JobAction &JA,
00051                                  const Driver &D,
00052                                  const llvm::opt::ArgList &Args,
00053                                  llvm::opt::ArgStringList &CmdArgs,
00054                                  const InputInfo &Output,
00055                                  const InputInfoList &Inputs) const;
00056 
00057     void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
00058                               llvm::opt::ArgStringList &CmdArgs) const;
00059     void AddARMTargetArgs(const llvm::opt::ArgList &Args,
00060                           llvm::opt::ArgStringList &CmdArgs,
00061                           bool KernelOrKext) const;
00062     void AddARM64TargetArgs(const llvm::opt::ArgList &Args,
00063                             llvm::opt::ArgStringList &CmdArgs) const;
00064     void AddMIPSTargetArgs(const llvm::opt::ArgList &Args,
00065                            llvm::opt::ArgStringList &CmdArgs) const;
00066     void AddPPCTargetArgs(const llvm::opt::ArgList &Args,
00067                           llvm::opt::ArgStringList &CmdArgs) const;
00068     void AddR600TargetArgs(const llvm::opt::ArgList &Args,
00069                            llvm::opt::ArgStringList &CmdArgs) const;
00070     void AddSparcTargetArgs(const llvm::opt::ArgList &Args,
00071                             llvm::opt::ArgStringList &CmdArgs) const;
00072     void AddSystemZTargetArgs(const llvm::opt::ArgList &Args,
00073                               llvm::opt::ArgStringList &CmdArgs) const;
00074     void AddX86TargetArgs(const llvm::opt::ArgList &Args,
00075                           llvm::opt::ArgStringList &CmdArgs) const;
00076     void AddHexagonTargetArgs(const llvm::opt::ArgList &Args,
00077                               llvm::opt::ArgStringList &CmdArgs) const;
00078 
00079     enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile };
00080 
00081     ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args,
00082                                    llvm::opt::ArgStringList &cmdArgs,
00083                                    RewriteKind rewrite) const;
00084 
00085     void AddClangCLArgs(const llvm::opt::ArgList &Args,
00086                         llvm::opt::ArgStringList &CmdArgs) const;
00087 
00088     visualstudio::Compile *getCLFallback() const;
00089 
00090     mutable std::unique_ptr<visualstudio::Compile> CLFallback;
00091 
00092   public:
00093     Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC, RF_Full) {}
00094 
00095     bool hasGoodDiagnostics() const override { return true; }
00096     bool hasIntegratedAssembler() const override { return true; }
00097     bool hasIntegratedCPP() const override { return true; }
00098 
00099     void ConstructJob(Compilation &C, const JobAction &JA,
00100                       const InputInfo &Output, const InputInfoList &Inputs,
00101                       const llvm::opt::ArgList &TCArgs,
00102                       const char *LinkingOutput) const override;
00103   };
00104 
00105   /// \brief Clang integrated assembler tool.
00106   class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
00107   public:
00108     ClangAs(const ToolChain &TC) : Tool("clang::as",
00109                                         "clang integrated assembler", TC,
00110                                         RF_Full) {}
00111 
00112     bool hasGoodDiagnostics() const override { return true; }
00113     bool hasIntegratedAssembler() const override { return false; }
00114     bool hasIntegratedCPP() const override { return false; }
00115 
00116     void ConstructJob(Compilation &C, const JobAction &JA,
00117                       const InputInfo &Output, const InputInfoList &Inputs,
00118                       const llvm::opt::ArgList &TCArgs,
00119                       const char *LinkingOutput) const override;
00120   };
00121 
00122   /// \brief Base class for all GNU tools that provide the same behavior when
00123   /// it comes to response files support
00124   class GnuTool : public Tool {
00125     virtual void anchor();
00126 
00127   public:
00128     GnuTool(const char *Name, const char *ShortName, const ToolChain &TC)
00129         : Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {}
00130   };
00131 
00132   /// gcc - Generic GCC tool implementations.
00133 namespace gcc {
00134   class LLVM_LIBRARY_VISIBILITY Common : public GnuTool {
00135   public:
00136     Common(const char *Name, const char *ShortName,
00137            const ToolChain &TC) : GnuTool(Name, ShortName, TC) {}
00138 
00139     void ConstructJob(Compilation &C, const JobAction &JA,
00140                       const InputInfo &Output,
00141                       const InputInfoList &Inputs,
00142                       const llvm::opt::ArgList &TCArgs,
00143                       const char *LinkingOutput) const override;
00144 
00145     /// RenderExtraToolArgs - Render any arguments necessary to force
00146     /// the particular tool mode.
00147     virtual void
00148         RenderExtraToolArgs(const JobAction &JA,
00149                             llvm::opt::ArgStringList &CmdArgs) const = 0;
00150   };
00151 
00152   class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
00153   public:
00154     Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
00155                                              "gcc preprocessor", TC) {}
00156 
00157     bool hasGoodDiagnostics() const override { return true; }
00158     bool hasIntegratedCPP() const override { return false; }
00159 
00160     void RenderExtraToolArgs(const JobAction &JA,
00161                              llvm::opt::ArgStringList &CmdArgs) const override;
00162   };
00163 
00164   class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
00165   public:
00166     Compile(const ToolChain &TC) : Common("gcc::Compile",
00167                                           "gcc frontend", TC) {}
00168 
00169     bool hasGoodDiagnostics() const override { return true; }
00170     bool hasIntegratedCPP() const override { return true; }
00171 
00172     void RenderExtraToolArgs(const JobAction &JA,
00173                              llvm::opt::ArgStringList &CmdArgs) const override;
00174   };
00175 
00176   class LLVM_LIBRARY_VISIBILITY Link : public Common  {
00177   public:
00178     Link(const ToolChain &TC) : Common("gcc::Link",
00179                                        "linker (via gcc)", TC) {}
00180 
00181     bool hasIntegratedCPP() const override { return false; }
00182     bool isLinkJob() const override { return true; }
00183 
00184     void RenderExtraToolArgs(const JobAction &JA,
00185                              llvm::opt::ArgStringList &CmdArgs) const override;
00186   };
00187 } // end namespace gcc
00188 
00189 namespace hexagon {
00190   // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
00191   // We simply use "clang -cc1" for those actions.
00192   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool {
00193   public:
00194     Assemble(const ToolChain &TC) : GnuTool("hexagon::Assemble",
00195       "hexagon-as", TC) {}
00196 
00197     bool hasIntegratedCPP() const override { return false; }
00198 
00199     void RenderExtraToolArgs(const JobAction &JA,
00200                              llvm::opt::ArgStringList &CmdArgs) const;
00201     void ConstructJob(Compilation &C, const JobAction &JA,
00202                       const InputInfo &Output, const InputInfoList &Inputs,
00203                       const llvm::opt::ArgList &TCArgs,
00204                       const char *LinkingOutput) const override;
00205   };
00206 
00207   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool {
00208   public:
00209     Link(const ToolChain &TC) : GnuTool("hexagon::Link",
00210       "hexagon-ld", TC) {}
00211 
00212     bool hasIntegratedCPP() const override { return false; }
00213     bool isLinkJob() const override { return true; }
00214 
00215     virtual void RenderExtraToolArgs(const JobAction &JA,
00216                                      llvm::opt::ArgStringList &CmdArgs) const;
00217     void ConstructJob(Compilation &C, const JobAction &JA,
00218                       const InputInfo &Output, const InputInfoList &Inputs,
00219                       const llvm::opt::ArgList &TCArgs,
00220                       const char *LinkingOutput) const override;
00221   };
00222 } // end namespace hexagon.
00223 
00224 namespace arm {
00225   StringRef getARMTargetCPU(const llvm::opt::ArgList &Args,
00226                             const llvm::Triple &Triple);
00227   const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
00228                                 const llvm::Triple &Triple);
00229   const char* getLLVMArchSuffixForARM(StringRef CPU);
00230 }
00231 
00232 namespace mips {
00233   void getMipsCPUAndABI(const llvm::opt::ArgList &Args,
00234                         const llvm::Triple &Triple, StringRef &CPUName,
00235                         StringRef &ABIName);
00236   bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
00237   bool isUCLibc(const llvm::opt::ArgList &Args);
00238   bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
00239   bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName,
00240                      StringRef ABIName);
00241 }
00242 
00243 namespace ppc {
00244   bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value);
00245 }
00246 
00247 namespace darwin {
00248   llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
00249   void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
00250 
00251   class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
00252     virtual void anchor();
00253   protected:
00254     void AddMachOArch(const llvm::opt::ArgList &Args,
00255                        llvm::opt::ArgStringList &CmdArgs) const;
00256 
00257     const toolchains::MachO &getMachOToolChain() const {
00258       return reinterpret_cast<const toolchains::MachO&>(getToolChain());
00259     }
00260 
00261   public:
00262   MachOTool(
00263       const char *Name, const char *ShortName, const ToolChain &TC,
00264       ResponseFileSupport ResponseSupport = RF_None,
00265       llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8,
00266       const char *ResponseFlag = "@")
00267       : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding,
00268              ResponseFlag) {}
00269   };
00270 
00271   class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool  {
00272   public:
00273     Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
00274                                               "assembler", TC) {}
00275 
00276     bool hasIntegratedCPP() const override { return false; }
00277 
00278     void ConstructJob(Compilation &C, const JobAction &JA,
00279                       const InputInfo &Output, const InputInfoList &Inputs,
00280                       const llvm::opt::ArgList &TCArgs,
00281                       const char *LinkingOutput) const override;
00282   };
00283 
00284   class LLVM_LIBRARY_VISIBILITY Link : public MachOTool  {
00285     bool NeedsTempPath(const InputInfoList &Inputs) const;
00286     void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
00287                      llvm::opt::ArgStringList &CmdArgs,
00288                      const InputInfoList &Inputs) const;
00289 
00290   public:
00291     Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC,
00292                                           RF_FileList, llvm::sys::WEM_UTF8,
00293                                           "-filelist") {}
00294 
00295     bool hasIntegratedCPP() const override { return false; }
00296     bool isLinkJob() const override { return true; }
00297 
00298     void ConstructJob(Compilation &C, const JobAction &JA,
00299                       const InputInfo &Output, const InputInfoList &Inputs,
00300                       const llvm::opt::ArgList &TCArgs,
00301                       const char *LinkingOutput) const override;
00302   };
00303 
00304   class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool  {
00305   public:
00306     Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
00307 
00308     bool hasIntegratedCPP() const override { return false; }
00309 
00310     void ConstructJob(Compilation &C, const JobAction &JA,
00311                       const InputInfo &Output, const InputInfoList &Inputs,
00312                       const llvm::opt::ArgList &TCArgs,
00313                       const char *LinkingOutput) const override;
00314   };
00315 
00316   class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool  {
00317   public:
00318     Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
00319                                               "dsymutil", TC) {}
00320 
00321     bool hasIntegratedCPP() const override { return false; }
00322     bool isDsymutilJob() const override { return true; }
00323 
00324     void ConstructJob(Compilation &C, const JobAction &JA,
00325                       const InputInfo &Output,
00326                       const InputInfoList &Inputs,
00327                       const llvm::opt::ArgList &TCArgs,
00328                       const char *LinkingOutput) const override;
00329   };
00330 
00331   class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool  {
00332   public:
00333     VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
00334                                                  "dwarfdump", TC) {}
00335 
00336     bool hasIntegratedCPP() const override { return false; }
00337 
00338     void ConstructJob(Compilation &C, const JobAction &JA,
00339                       const InputInfo &Output, const InputInfoList &Inputs,
00340                       const llvm::opt::ArgList &TCArgs,
00341                       const char *LinkingOutput) const override;
00342   };
00343 
00344 }
00345 
00346   /// openbsd -- Directly call GNU Binutils assembler and linker
00347 namespace openbsd {
00348   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00349   public:
00350     Assemble(const ToolChain &TC) : GnuTool("openbsd::Assemble", "assembler",
00351                                          TC) {}
00352 
00353     bool hasIntegratedCPP() const override { return false; }
00354 
00355     void ConstructJob(Compilation &C, const JobAction &JA,
00356                       const InputInfo &Output,
00357                       const InputInfoList &Inputs,
00358                       const llvm::opt::ArgList &TCArgs,
00359                       const char *LinkingOutput) const override;
00360   };
00361   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00362   public:
00363     Link(const ToolChain &TC) : GnuTool("openbsd::Link", "linker", TC) {}
00364 
00365     bool hasIntegratedCPP() const override { return false; }
00366     bool isLinkJob() const override { return true; }
00367 
00368     void ConstructJob(Compilation &C, const JobAction &JA,
00369                       const InputInfo &Output, const InputInfoList &Inputs,
00370                       const llvm::opt::ArgList &TCArgs,
00371                       const char *LinkingOutput) const override;
00372   };
00373 } // end namespace openbsd
00374 
00375   /// bitrig -- Directly call GNU Binutils assembler and linker
00376 namespace bitrig {
00377   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00378   public:
00379     Assemble(const ToolChain &TC) : GnuTool("bitrig::Assemble", "assembler",
00380                                          TC) {}
00381 
00382     bool hasIntegratedCPP() const override { return false; }
00383 
00384     void ConstructJob(Compilation &C, const JobAction &JA,
00385                       const InputInfo &Output, const InputInfoList &Inputs,
00386                       const llvm::opt::ArgList &TCArgs,
00387                       const char *LinkingOutput) const override;
00388   };
00389   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00390   public:
00391     Link(const ToolChain &TC) : GnuTool("bitrig::Link", "linker", TC) {}
00392 
00393     bool hasIntegratedCPP() const override { return false; }
00394     bool isLinkJob() const override { return true; }
00395 
00396     void ConstructJob(Compilation &C, const JobAction &JA,
00397                       const InputInfo &Output, const InputInfoList &Inputs,
00398                       const llvm::opt::ArgList &TCArgs,
00399                       const char *LinkingOutput) const override;
00400   };
00401 } // end namespace bitrig
00402 
00403   /// freebsd -- Directly call GNU Binutils assembler and linker
00404 namespace freebsd {
00405   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00406   public:
00407     Assemble(const ToolChain &TC) : GnuTool("freebsd::Assemble", "assembler",
00408                                          TC) {}
00409 
00410     bool hasIntegratedCPP() const override { return false; }
00411 
00412     void ConstructJob(Compilation &C, const JobAction &JA,
00413                       const InputInfo &Output, const InputInfoList &Inputs,
00414                       const llvm::opt::ArgList &TCArgs,
00415                       const char *LinkingOutput) const override;
00416   };
00417   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00418   public:
00419     Link(const ToolChain &TC) : GnuTool("freebsd::Link", "linker", TC) {}
00420 
00421     bool hasIntegratedCPP() const override { return false; }
00422     bool isLinkJob() const override { return true; }
00423 
00424     void ConstructJob(Compilation &C, const JobAction &JA,
00425                       const InputInfo &Output, const InputInfoList &Inputs,
00426                       const llvm::opt::ArgList &TCArgs,
00427                       const char *LinkingOutput) const override;
00428   };
00429 } // end namespace freebsd
00430 
00431   /// netbsd -- Directly call GNU Binutils assembler and linker
00432 namespace netbsd {
00433   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00434 
00435   public:
00436     Assemble(const ToolChain &TC)
00437       : GnuTool("netbsd::Assemble", "assembler", TC) {}
00438 
00439     bool hasIntegratedCPP() const override { return false; }
00440 
00441     void ConstructJob(Compilation &C, const JobAction &JA,
00442                       const InputInfo &Output, const InputInfoList &Inputs,
00443                       const llvm::opt::ArgList &TCArgs,
00444                       const char *LinkingOutput) const override;
00445   };
00446   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00447 
00448   public:
00449     Link(const ToolChain &TC)
00450       : GnuTool("netbsd::Link", "linker", TC) {}
00451 
00452     bool hasIntegratedCPP() const override { return false; }
00453     bool isLinkJob() const override { return true; }
00454 
00455     void ConstructJob(Compilation &C, const JobAction &JA,
00456                       const InputInfo &Output, const InputInfoList &Inputs,
00457                       const llvm::opt::ArgList &TCArgs,
00458                       const char *LinkingOutput) const override;
00459   };
00460 } // end namespace netbsd
00461 
00462   /// Directly call GNU Binutils' assembler and linker.
00463 namespace gnutools {
00464   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00465   public:
00466     Assemble(const ToolChain &TC) : GnuTool("GNU::Assemble", "assembler", TC) {}
00467 
00468     bool hasIntegratedCPP() const override { return false; }
00469 
00470     void ConstructJob(Compilation &C, const JobAction &JA,
00471                       const InputInfo &Output,
00472                       const InputInfoList &Inputs,
00473                       const llvm::opt::ArgList &TCArgs,
00474                       const char *LinkingOutput) const override;
00475   };
00476   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00477   public:
00478     Link(const ToolChain &TC) : GnuTool("GNU::Link", "linker", TC) {}
00479 
00480     bool hasIntegratedCPP() const override { return false; }
00481     bool isLinkJob() const override { return true; }
00482 
00483     void ConstructJob(Compilation &C, const JobAction &JA,
00484                       const InputInfo &Output,
00485                       const InputInfoList &Inputs,
00486                       const llvm::opt::ArgList &TCArgs,
00487                       const char *LinkingOutput) const override;
00488   };
00489 }
00490   /// minix -- Directly call GNU Binutils assembler and linker
00491 namespace minix {
00492   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00493   public:
00494     Assemble(const ToolChain &TC) : GnuTool("minix::Assemble", "assembler",
00495                                          TC) {}
00496 
00497     bool hasIntegratedCPP() const override { return false; }
00498 
00499     void ConstructJob(Compilation &C, const JobAction &JA,
00500                       const InputInfo &Output,
00501                       const InputInfoList &Inputs,
00502                       const llvm::opt::ArgList &TCArgs,
00503                       const char *LinkingOutput) const override;
00504   };
00505   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00506   public:
00507     Link(const ToolChain &TC) : GnuTool("minix::Link", "linker", TC) {}
00508 
00509     bool hasIntegratedCPP() const override { return false; }
00510     bool isLinkJob() const override { return true; }
00511 
00512     void ConstructJob(Compilation &C, const JobAction &JA,
00513                       const InputInfo &Output,
00514                       const InputInfoList &Inputs,
00515                       const llvm::opt::ArgList &TCArgs,
00516                       const char *LinkingOutput) const override;
00517   };
00518 } // end namespace minix
00519 
00520   /// solaris -- Directly call Solaris assembler and linker
00521 namespace solaris {
00522   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
00523   public:
00524     Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
00525                                          TC) {}
00526 
00527     bool hasIntegratedCPP() const override { return false; }
00528 
00529     void ConstructJob(Compilation &C, const JobAction &JA,
00530                       const InputInfo &Output, const InputInfoList &Inputs,
00531                       const llvm::opt::ArgList &TCArgs,
00532                       const char *LinkingOutput) const override;
00533   };
00534   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
00535   public:
00536     Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {}
00537 
00538     bool hasIntegratedCPP() const override { return false; }
00539     bool isLinkJob() const override { return true; }
00540 
00541     void ConstructJob(Compilation &C, const JobAction &JA,
00542                       const InputInfo &Output, const InputInfoList &Inputs,
00543                       const llvm::opt::ArgList &TCArgs,
00544                       const char *LinkingOutput) const override;
00545   };
00546 } // end namespace solaris
00547 
00548   /// dragonfly -- Directly call GNU Binutils assembler and linker
00549 namespace dragonfly {
00550   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
00551   public:
00552     Assemble(const ToolChain &TC) : GnuTool("dragonfly::Assemble", "assembler",
00553                                          TC) {}
00554 
00555     bool hasIntegratedCPP() const override { return false; }
00556 
00557     void ConstructJob(Compilation &C, const JobAction &JA,
00558                       const InputInfo &Output, const InputInfoList &Inputs,
00559                       const llvm::opt::ArgList &TCArgs,
00560                       const char *LinkingOutput) const override;
00561   };
00562   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
00563   public:
00564     Link(const ToolChain &TC) : GnuTool("dragonfly::Link", "linker", TC) {}
00565 
00566     bool hasIntegratedCPP() const override { return false; }
00567     bool isLinkJob() const override { return true; }
00568 
00569     void ConstructJob(Compilation &C, const JobAction &JA,
00570                       const InputInfo &Output,
00571                       const InputInfoList &Inputs,
00572                       const llvm::opt::ArgList &TCArgs,
00573                       const char *LinkingOutput) const override;
00574   };
00575 } // end namespace dragonfly
00576 
00577 /// Visual studio tools.
00578 namespace visualstudio {
00579   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
00580   public:
00581     Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC,
00582                                      RF_Full, llvm::sys::WEM_UTF16) {}
00583 
00584     bool hasIntegratedCPP() const override { return false; }
00585     bool isLinkJob() const override { return true; }
00586 
00587     void ConstructJob(Compilation &C, const JobAction &JA,
00588                       const InputInfo &Output, const InputInfoList &Inputs,
00589                       const llvm::opt::ArgList &TCArgs,
00590                       const char *LinkingOutput) const override;
00591   };
00592 
00593   class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
00594   public:
00595     Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC,
00596                                         RF_Full, llvm::sys::WEM_UTF16) {}
00597 
00598     bool hasIntegratedAssembler() const override { return true; }
00599     bool hasIntegratedCPP() const override { return true; }
00600     bool isLinkJob() const override { return false; }
00601 
00602     void ConstructJob(Compilation &C, const JobAction &JA,
00603                       const InputInfo &Output, const InputInfoList &Inputs,
00604                       const llvm::opt::ArgList &TCArgs,
00605                       const char *LinkingOutput) const override;
00606 
00607     std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA,
00608                                         const InputInfo &Output,
00609                                         const InputInfoList &Inputs,
00610                                         const llvm::opt::ArgList &TCArgs,
00611                                         const char *LinkingOutput) const;
00612   };
00613 } // end namespace visualstudio
00614 
00615 namespace arm {
00616   StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
00617                          const llvm::Triple &Triple);
00618 }
00619 namespace XCore {
00620   // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
00621   // We simply use "clang -cc1" for those actions.
00622   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
00623   public:
00624     Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
00625       "XCore-as", TC) {}
00626 
00627     bool hasIntegratedCPP() const override { return false; }
00628     void ConstructJob(Compilation &C, const JobAction &JA,
00629                       const InputInfo &Output, const InputInfoList &Inputs,
00630                       const llvm::opt::ArgList &TCArgs,
00631                       const char *LinkingOutput) const override;
00632   };
00633 
00634   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
00635   public:
00636     Link(const ToolChain &TC) : Tool("XCore::Link",
00637       "XCore-ld", TC) {}
00638 
00639     bool hasIntegratedCPP() const override { return false; }
00640     bool isLinkJob() const override { return true; }
00641     void ConstructJob(Compilation &C, const JobAction &JA,
00642                       const InputInfo &Output, const InputInfoList &Inputs,
00643                       const llvm::opt::ArgList &TCArgs,
00644                       const char *LinkingOutput) const override;
00645   };
00646 } // end namespace XCore.
00647 
00648 namespace CrossWindows {
00649 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
00650 public:
00651   Assemble(const ToolChain &TC) : Tool("CrossWindows::Assemble", "as", TC) { }
00652 
00653   bool hasIntegratedCPP() const override { return false; }
00654 
00655   void ConstructJob(Compilation &C, const JobAction &JA,
00656                     const InputInfo &Output, const InputInfoList &Inputs,
00657                     const llvm::opt::ArgList &TCArgs,
00658                     const char *LinkingOutput) const override;
00659 };
00660 
00661 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
00662 public:
00663   Link(const ToolChain &TC) : Tool("CrossWindows::Link", "ld", TC, RF_Full) {}
00664 
00665   bool hasIntegratedCPP() const override { return false; }
00666   bool isLinkJob() const override { return true; }
00667 
00668   void ConstructJob(Compilation &C, const JobAction &JA,
00669                     const InputInfo &Output, const InputInfoList &Inputs,
00670                     const llvm::opt::ArgList &TCArgs,
00671                     const char *LinkingOutput) const override;
00672 };
00673 }
00674 
00675 } // end namespace toolchains
00676 } // end namespace driver
00677 } // end namespace clang
00678 
00679 #endif