diff options
Diffstat (limited to 'lib/Driver/Tools.h')
-rw-r--r-- | lib/Driver/Tools.h | 498 |
1 files changed, 266 insertions, 232 deletions
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index 753f542622fea..52ab731cbc465 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -32,11 +32,14 @@ namespace toolchains { namespace tools { namespace visualstudio { - class Compile; +class Compiler; } using llvm::opt::ArgStringList; +SmallString<128> getCompilerRT(const ToolChain &TC, StringRef Component, + bool Shared = false); + /// \brief Clang compiler tool. class LLVM_LIBRARY_VISIBILITY Clang : public Tool { public: @@ -86,11 +89,14 @@ using llvm::opt::ArgStringList; void AddClangCLArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; - visualstudio::Compile *getCLFallback() const; + visualstudio::Compiler *getCLFallback() const; - mutable std::unique_ptr<visualstudio::Compile> CLFallback; + mutable std::unique_ptr<visualstudio::Compiler> CLFallback; public: + // CAUTION! The first constructor argument ("clang") is not arbitrary, + // as it is for other tools. Some operations on a Tool actually test + // whether that tool is Clang based on the Tool's Name as a string. Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC, RF_Full) {} bool hasGoodDiagnostics() const override { return true; } @@ -124,7 +130,7 @@ using llvm::opt::ArgStringList; /// \brief Base class for all GNU tools that provide the same behavior when /// it comes to response files support - class GnuTool : public Tool { + class LLVM_LIBRARY_VISIBILITY GnuTool : public Tool { virtual void anchor(); public: @@ -148,14 +154,14 @@ namespace gcc { /// RenderExtraToolArgs - Render any arguments necessary to force /// the particular tool mode. virtual void - RenderExtraToolArgs(const JobAction &JA, - llvm::opt::ArgStringList &CmdArgs) const = 0; + RenderExtraToolArgs(const JobAction &JA, + llvm::opt::ArgStringList &CmdArgs) const = 0; }; - class LLVM_LIBRARY_VISIBILITY Preprocess : public Common { + class LLVM_LIBRARY_VISIBILITY Preprocessor : public Common { public: - Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", - "gcc preprocessor", TC) {} + Preprocessor(const ToolChain &TC) + : Common("gcc::Preprocessor", "gcc preprocessor", TC) {} bool hasGoodDiagnostics() const override { return true; } bool hasIntegratedCPP() const override { return false; } @@ -164,10 +170,10 @@ namespace gcc { llvm::opt::ArgStringList &CmdArgs) const override; }; - class LLVM_LIBRARY_VISIBILITY Compile : public Common { + class LLVM_LIBRARY_VISIBILITY Compiler : public Common { public: - Compile(const ToolChain &TC) : Common("gcc::Compile", - "gcc frontend", TC) {} + Compiler(const ToolChain &TC) + : Common("gcc::Compiler", "gcc frontend", TC) {} bool hasGoodDiagnostics() const override { return true; } bool hasIntegratedCPP() const override { return true; } @@ -176,10 +182,10 @@ namespace gcc { llvm::opt::ArgStringList &CmdArgs) const override; }; - class LLVM_LIBRARY_VISIBILITY Link : public Common { + class LLVM_LIBRARY_VISIBILITY Linker : public Common { public: - Link(const ToolChain &TC) : Common("gcc::Link", - "linker (via gcc)", TC) {} + Linker(const ToolChain &TC) + : Common("gcc::Linker", "linker (via gcc)", TC) {} bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } @@ -190,14 +196,15 @@ namespace gcc { } // end namespace gcc namespace hexagon { - // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile. - // We simply use "clang -cc1" for those actions. - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("hexagon::Assemble", - "hexagon-as", TC) {} +// For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile +// and Compile. +// We simply use "clang -cc1" for those actions. +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("hexagon::Assembler", "hexagon-as", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } void RenderExtraToolArgs(const JobAction &JA, llvm::opt::ArgStringList &CmdArgs) const; @@ -205,14 +212,13 @@ namespace hexagon { const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; - }; +}; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("hexagon::Link", - "hexagon-ld", TC) {} +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("hexagon::Linker", "hexagon-ld", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } virtual void RenderExtraToolArgs(const JobAction &JA, @@ -258,11 +264,11 @@ namespace ppc { bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value); } - /// cloudabi -- Directly call GNU Binutils linker +/// cloudabi -- Directly call GNU Binutils linker namespace cloudabi { -class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { public: - Link(const ToolChain &TC) : GnuTool("cloudabi::Link", "linker", TC) {} + Linker(const ToolChain &TC) : GnuTool("cloudabi::Linker", "linker", TC) {} bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } @@ -289,19 +295,19 @@ namespace darwin { } public: - MachOTool( - const char *Name, const char *ShortName, const ToolChain &TC, - ResponseFileSupport ResponseSupport = RF_None, - llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, - const char *ResponseFlag = "@") - : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding, - ResponseFlag) {} + MachOTool( + const char *Name, const char *ShortName, const ToolChain &TC, + ResponseFileSupport ResponseSupport = RF_None, + llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, + const char *ResponseFlag = "@") + : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding, + ResponseFlag) {} }; - class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool { + class LLVM_LIBRARY_VISIBILITY Assembler : public MachOTool { public: - Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble", - "assembler", TC) {} + Assembler(const ToolChain &TC) + : MachOTool("darwin::Assembler", "assembler", TC) {} bool hasIntegratedCPP() const override { return false; } @@ -311,16 +317,16 @@ namespace darwin { const char *LinkingOutput) const override; }; - class LLVM_LIBRARY_VISIBILITY Link : public MachOTool { + class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool { bool NeedsTempPath(const InputInfoList &Inputs) const; void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfoList &Inputs) const; public: - Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC, - RF_FileList, llvm::sys::WEM_UTF8, - "-filelist") {} + Linker(const ToolChain &TC) + : MachOTool("darwin::Linker", "linker", TC, RF_FileList, + llvm::sys::WEM_UTF8, "-filelist") {} bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } @@ -373,27 +379,26 @@ namespace darwin { } - /// openbsd -- Directly call GNU Binutils assembler and linker +/// openbsd -- Directly call GNU Binutils assembler and linker namespace openbsd { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("openbsd::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("openbsd::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("openbsd::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("openbsd::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -402,26 +407,26 @@ namespace openbsd { }; } // end namespace openbsd - /// bitrig -- Directly call GNU Binutils assembler and linker +/// bitrig -- Directly call GNU Binutils assembler and linker namespace bitrig { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("bitrig::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("bitrig::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("bitrig::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("bitrig::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -430,26 +435,26 @@ namespace bitrig { }; } // end namespace bitrig - /// freebsd -- Directly call GNU Binutils assembler and linker +/// freebsd -- Directly call GNU Binutils assembler and linker namespace freebsd { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("freebsd::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("freebsd::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("freebsd::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("freebsd::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -458,29 +463,28 @@ namespace freebsd { }; } // end namespace freebsd - /// netbsd -- Directly call GNU Binutils assembler and linker +/// netbsd -- Directly call GNU Binutils assembler and linker namespace netbsd { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { - public: - Assemble(const ToolChain &TC) - : GnuTool("netbsd::Assemble", "assembler", TC) {} +public: + Assembler(const ToolChain &TC) + : GnuTool("netbsd::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { - public: - Link(const ToolChain &TC) - : GnuTool("netbsd::Link", "linker", TC) {} +public: + Linker(const ToolChain &TC) : GnuTool("netbsd::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -489,26 +493,25 @@ namespace netbsd { }; } // end namespace netbsd - /// Directly call GNU Binutils' assembler and linker. +/// Directly call GNU Binutils' assembler and linker. namespace gnutools { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("GNU::Assemble", "assembler", TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) : GnuTool("GNU::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("GNU::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("GNU::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, @@ -516,22 +519,21 @@ namespace gnutools { const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; }; -} + } -namespace nacltools { - class LLVM_LIBRARY_VISIBILITY AssembleARM : public gnutools::Assemble { + namespace nacltools { + class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler { public: - AssembleARM(const ToolChain &TC) : gnutools::Assemble(TC) {} + AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {} void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, + const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; }; - class LLVM_LIBRARY_VISIBILITY Link : public Tool { + class LLVM_LIBRARY_VISIBILITY Linker : public Tool { public: - Link(const ToolChain &TC) : Tool("NaCl::Link", "linker", TC) {} + Linker(const ToolChain &TC) : Tool("NaCl::Linker", "linker", TC) {} bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } @@ -544,27 +546,26 @@ namespace nacltools { }; } - /// minix -- Directly call GNU Binutils assembler and linker +/// minix -- Directly call GNU Binutils assembler and linker namespace minix { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("minix::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("minix::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("minix::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("minix::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, @@ -574,26 +575,26 @@ namespace minix { }; } // end namespace minix - /// solaris -- Directly call Solaris assembler and linker +/// solaris -- Directly call Solaris assembler and linker namespace solaris { - class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { - public: - Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { +public: + Assembler(const ToolChain &TC) + : Tool("solaris::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public Tool { - public: - Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public Tool { +public: + Linker(const ToolChain &TC) : Tool("solaris::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -602,26 +603,26 @@ namespace solaris { }; } // end namespace solaris - /// dragonfly -- Directly call GNU Binutils assembler and linker +/// dragonfly -- Directly call GNU Binutils assembler and linker namespace dragonfly { - class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool { - public: - Assemble(const ToolChain &TC) : GnuTool("dragonfly::Assemble", "assembler", - TC) {} +class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool { +public: + Assembler(const ToolChain &TC) + : GnuTool("dragonfly::Assembler", "assembler", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; - }; - class LLVM_LIBRARY_VISIBILITY Link : public GnuTool { - public: - Link(const ToolChain &TC) : GnuTool("dragonfly::Link", "linker", TC) {} + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; +class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { +public: + Linker(const ToolChain &TC) : GnuTool("dragonfly::Linker", "linker", TC) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, @@ -633,30 +634,31 @@ namespace dragonfly { /// Visual studio tools. namespace visualstudio { - VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args, - bool IsWindowsMSVC); +VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple, + const llvm::opt::ArgList &Args, bool IsWindowsMSVC); - class LLVM_LIBRARY_VISIBILITY Link : public Tool { - public: - Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC, - RF_Full, llvm::sys::WEM_UTF16) {} +class LLVM_LIBRARY_VISIBILITY Linker : public Tool { +public: + Linker(const ToolChain &TC) + : Tool("visualstudio::Linker", "linker", TC, RF_Full, + llvm::sys::WEM_UTF16) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; - }; +}; - class LLVM_LIBRARY_VISIBILITY Compile : public Tool { - public: - Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC, - RF_Full, llvm::sys::WEM_UTF16) {} +class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { +public: + Compiler(const ToolChain &TC) + : Tool("visualstudio::Compiler", "compiler", TC, RF_Full, + llvm::sys::WEM_UTF16) {} - bool hasIntegratedAssembler() const override { return true; } + bool hasIntegratedAssembler() const override { return true; } bool hasIntegratedCPP() const override { return true; } bool isLinkJob() const override { return false; } @@ -673,58 +675,90 @@ namespace visualstudio { }; } // end namespace visualstudio +/// MinGW -- Directly call GNU Binutils assembler and linker +namespace MinGW { +class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { +public: + Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {} + + bool hasIntegratedCPP() const override { return false; } + + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; + +class LLVM_LIBRARY_VISIBILITY Linker : public Tool { +public: + Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {} + + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } + + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; + +private: + void AddLibGCC(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const; +}; +} // end namespace MinGW + namespace arm { StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &Triple); } namespace XCore { - // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile. - // We simply use "clang -cc1" for those actions. - class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { - public: - Assemble(const ToolChain &TC) : Tool("XCore::Assemble", - "XCore-as", TC) {} +// For XCore, we do not need to instantiate tools for PreProcess, PreCompile and +// Compile. +// We simply use "clang -cc1" for those actions. +class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { +public: + Assembler(const ToolChain &TC) : Tool("XCore::Assembler", "XCore-as", TC) {} - bool hasIntegratedCPP() const override { return false; } + bool hasIntegratedCPP() const override { return false; } + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; + +class LLVM_LIBRARY_VISIBILITY Linker : public Tool { +public: + Linker(const ToolChain &TC) : Tool("XCore::Linker", "XCore-ld", TC) {} + + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; }; + } // end namespace XCore. - class LLVM_LIBRARY_VISIBILITY Link : public Tool { + namespace CrossWindows { + class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { public: - Link(const ToolChain &TC) : Tool("XCore::Link", - "XCore-ld", TC) {} + Assembler(const ToolChain &TC) + : Tool("CrossWindows::Assembler", "as", TC) {} bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override; }; -} // end namespace XCore. - -namespace CrossWindows { -class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { -public: - Assemble(const ToolChain &TC) : Tool("CrossWindows::Assemble", "as", TC) { } - - bool hasIntegratedCPP() const override { return false; } - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; -}; - -class LLVM_LIBRARY_VISIBILITY Link : public Tool { -public: - Link(const ToolChain &TC) : Tool("CrossWindows::Link", "ld", TC, RF_Full) {} + class LLVM_LIBRARY_VISIBILITY Linker : public Tool { + public: + Linker(const ToolChain &TC) + : Tool("CrossWindows::Linker", "ld", TC, RF_Full) {} - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } + bool hasIntegratedCPP() const override { return false; } + bool isLinkJob() const override { return true; } void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -735,9 +769,9 @@ public: /// SHAVE tools -- Directly call moviCompile and moviAsm namespace SHAVE { -class LLVM_LIBRARY_VISIBILITY Compile : public Tool { +class LLVM_LIBRARY_VISIBILITY Compiler : public Tool { public: - Compile(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {} + Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {} bool hasIntegratedCPP() const override { return true; } @@ -747,9 +781,9 @@ public: const char *LinkingOutput) const override; }; -class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { +class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { public: - Assemble(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {} + Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {} bool hasIntegratedCPP() const override { return false; } // not sure. |