Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 1 | //===--- Tools.h - Tool 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_TOOLS_H_ |
| 11 | #define CLANG_LIB_DRIVER_TOOLS_H_ |
| 12 | |
| 13 | #include "clang/Driver/Tool.h" |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 14 | #include "clang/Driver/Types.h" |
Daniel Dunbar | b488c1d | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 15 | #include "clang/Driver/Util.h" |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 16 | |
| 17 | #include "llvm/Support/Compiler.h" |
| 18 | |
| 19 | namespace clang { |
| 20 | namespace driver { |
Douglas Gregor | df91ef3 | 2009-04-18 00:34:01 +0000 | [diff] [blame] | 21 | class Driver; |
| 22 | |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 23 | namespace toolchains { |
Daniel Dunbar | f395528 | 2009-09-04 18:34:51 +0000 | [diff] [blame] | 24 | class Darwin; |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 25 | } |
| 26 | |
Daniel Dunbar | 985b825 | 2009-03-17 22:18:43 +0000 | [diff] [blame] | 27 | namespace tools { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 28 | |
Daniel Dunbar | 20a9aa5 | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 29 | /// \brief Clang compiler tool. |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 30 | class LLVM_LIBRARY_VISIBILITY Clang : public Tool { |
Douglas Gregor | df91ef3 | 2009-04-18 00:34:01 +0000 | [diff] [blame] | 31 | void AddPreprocessingOptions(const Driver &D, |
| 32 | const ArgList &Args, |
Daniel Dunbar | c21c485 | 2009-04-08 23:54:23 +0000 | [diff] [blame] | 33 | ArgStringList &CmdArgs, |
| 34 | const InputInfo &Output, |
| 35 | const InputInfoList &Inputs) const; |
| 36 | |
Daniel Dunbar | b163ef7 | 2009-09-10 04:57:17 +0000 | [diff] [blame] | 37 | void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const; |
Eric Christopher | ed73473 | 2010-03-02 02:41:08 +0000 | [diff] [blame] | 38 | void AddMIPSTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const; |
Daniel Dunbar | 6acda16 | 2009-09-09 22:33:08 +0000 | [diff] [blame] | 39 | void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const; |
| 40 | |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 41 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 42 | Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 43 | |
| 44 | virtual bool acceptsPipedInput() const { return true; } |
| 45 | virtual bool canPipeOutput() const { return true; } |
Daniel Dunbar | 60a53f2 | 2010-04-06 17:07:49 +0000 | [diff] [blame] | 46 | virtual bool hasGoodDiagnostics() const { return true; } |
Daniel Dunbar | 8767cbc | 2010-02-03 03:07:56 +0000 | [diff] [blame] | 47 | virtual bool hasIntegratedAssembler() const { return true; } |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 48 | virtual bool hasIntegratedCPP() const { return true; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 49 | |
| 50 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
Daniel Dunbar | 871adcf | 2009-03-18 07:06:02 +0000 | [diff] [blame] | 51 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 52 | const InputInfo &Output, |
| 53 | const InputInfoList &Inputs, |
| 54 | const ArgList &TCArgs, |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 55 | const char *LinkingOutput) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
Daniel Dunbar | 20a9aa5 | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 58 | /// \brief Clang integrated assembler tool. |
| 59 | class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool { |
| 60 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 61 | ClangAs(const ToolChain &TC) : Tool("clang::as", |
| 62 | "clang integrated assembler", TC) {} |
Daniel Dunbar | 20a9aa5 | 2010-05-20 21:30:13 +0000 | [diff] [blame] | 63 | |
| 64 | virtual bool acceptsPipedInput() const { return true; } |
| 65 | virtual bool canPipeOutput() const { return true; } |
| 66 | virtual bool hasGoodDiagnostics() const { return true; } |
| 67 | virtual bool hasIntegratedAssembler() const { return false; } |
| 68 | virtual bool hasIntegratedCPP() const { return false; } |
| 69 | |
| 70 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 71 | Job &Dest, |
| 72 | const InputInfo &Output, |
| 73 | const InputInfoList &Inputs, |
| 74 | const ArgList &TCArgs, |
| 75 | const char *LinkingOutput) const; |
| 76 | }; |
| 77 | |
Daniel Dunbar | 31b1e54 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 78 | /// gcc - Generic GCC tool implementations. |
| 79 | namespace gcc { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 80 | class LLVM_LIBRARY_VISIBILITY Common : public Tool { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 81 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 82 | Common(const char *Name, const char *ShortName, |
| 83 | const ToolChain &TC) : Tool(Name, ShortName, TC) {} |
Daniel Dunbar | b488c1d | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 84 | |
| 85 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 86 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 87 | const InputInfo &Output, |
| 88 | const InputInfoList &Inputs, |
| 89 | const ArgList &TCArgs, |
Daniel Dunbar | b488c1d | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 90 | const char *LinkingOutput) const; |
| 91 | |
| 92 | /// RenderExtraToolArgs - Render any arguments necessary to force |
| 93 | /// the particular tool mode. |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 94 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 95 | ArgStringList &CmdArgs) const = 0; |
Daniel Dunbar | b488c1d | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 98 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 99 | class LLVM_LIBRARY_VISIBILITY Preprocess : public Common { |
Daniel Dunbar | b488c1d | 2009-03-18 08:07:30 +0000 | [diff] [blame] | 100 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 101 | Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", |
| 102 | "gcc preprocessor", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 103 | |
| 104 | virtual bool acceptsPipedInput() const { return true; } |
| 105 | virtual bool canPipeOutput() const { return true; } |
Daniel Dunbar | 60a53f2 | 2010-04-06 17:07:49 +0000 | [diff] [blame] | 106 | virtual bool hasGoodDiagnostics() const { return true; } |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 107 | virtual bool hasIntegratedCPP() const { return false; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 108 | |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 109 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 110 | ArgStringList &CmdArgs) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 111 | }; |
| 112 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 113 | class LLVM_LIBRARY_VISIBILITY Precompile : public Common { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 114 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 115 | Precompile(const ToolChain &TC) : Common("gcc::Precompile", |
| 116 | "gcc precompile", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 117 | |
| 118 | virtual bool acceptsPipedInput() const { return true; } |
| 119 | virtual bool canPipeOutput() const { return false; } |
Daniel Dunbar | 60a53f2 | 2010-04-06 17:07:49 +0000 | [diff] [blame] | 120 | virtual bool hasGoodDiagnostics() const { return true; } |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 121 | virtual bool hasIntegratedCPP() const { return true; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 122 | |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 123 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 124 | ArgStringList &CmdArgs) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 127 | class LLVM_LIBRARY_VISIBILITY Compile : public Common { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 128 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 129 | Compile(const ToolChain &TC) : Common("gcc::Compile", |
| 130 | "gcc frontend", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 131 | |
| 132 | virtual bool acceptsPipedInput() const { return true; } |
| 133 | virtual bool canPipeOutput() const { return true; } |
Daniel Dunbar | 60a53f2 | 2010-04-06 17:07:49 +0000 | [diff] [blame] | 134 | virtual bool hasGoodDiagnostics() const { return true; } |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 135 | virtual bool hasIntegratedCPP() const { return true; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 136 | |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 137 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 138 | ArgStringList &CmdArgs) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 141 | class LLVM_LIBRARY_VISIBILITY Assemble : public Common { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 142 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 143 | Assemble(const ToolChain &TC) : Common("gcc::Assemble", |
| 144 | "assembler (via gcc)", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 145 | |
| 146 | virtual bool acceptsPipedInput() const { return true; } |
| 147 | virtual bool canPipeOutput() const { return false; } |
| 148 | virtual bool hasIntegratedCPP() const { return false; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 149 | |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 150 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 151 | ArgStringList &CmdArgs) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 152 | }; |
| 153 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 154 | class LLVM_LIBRARY_VISIBILITY Link : public Common { |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 155 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 156 | Link(const ToolChain &TC) : Common("gcc::Link", |
| 157 | "linker (via gcc)", TC) {} |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 158 | |
| 159 | virtual bool acceptsPipedInput() const { return false; } |
| 160 | virtual bool canPipeOutput() const { return false; } |
| 161 | virtual bool hasIntegratedCPP() const { return false; } |
Daniel Dunbar | 47ac7d2 | 2009-03-18 06:00:36 +0000 | [diff] [blame] | 162 | |
Daniel Dunbar | 82b51cc | 2010-01-25 22:35:08 +0000 | [diff] [blame] | 163 | virtual void RenderExtraToolArgs(const JobAction &JA, |
| 164 | ArgStringList &CmdArgs) const; |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 165 | }; |
Daniel Dunbar | 31b1e54 | 2009-03-17 22:45:24 +0000 | [diff] [blame] | 166 | } // end namespace gcc |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 167 | |
Daniel Dunbar | ff7488d | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 168 | namespace darwin { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 169 | class LLVM_LIBRARY_VISIBILITY DarwinTool : public Tool { |
Daniel Dunbar | fbefe6b | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 170 | protected: |
| 171 | void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const; |
Daniel Dunbar | fbefe6b | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 172 | |
| 173 | const toolchains::Darwin &getDarwinToolChain() const { |
| 174 | return reinterpret_cast<const toolchains::Darwin&>(getToolChain()); |
| 175 | } |
| 176 | |
| 177 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 178 | DarwinTool(const char *Name, const char *ShortName, |
| 179 | const ToolChain &TC) : Tool(Name, ShortName, TC) {} |
Daniel Dunbar | fbefe6b | 2009-09-09 18:36:20 +0000 | [diff] [blame] | 180 | }; |
| 181 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 182 | class LLVM_LIBRARY_VISIBILITY CC1 : public DarwinTool { |
Daniel Dunbar | a5a7bd0 | 2009-03-30 00:34:04 +0000 | [diff] [blame] | 183 | public: |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 184 | static const char *getBaseInputName(const ArgList &Args, |
Daniel Dunbar | a5a7bd0 | 2009-03-30 00:34:04 +0000 | [diff] [blame] | 185 | const InputInfoList &Input); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 186 | static const char *getBaseInputStem(const ArgList &Args, |
Daniel Dunbar | a5a7bd0 | 2009-03-30 00:34:04 +0000 | [diff] [blame] | 187 | const InputInfoList &Input); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 188 | static const char *getDependencyFileName(const ArgList &Args, |
Daniel Dunbar | a5a7bd0 | 2009-03-30 00:34:04 +0000 | [diff] [blame] | 189 | const InputInfoList &Inputs); |
| 190 | |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 191 | protected: |
| 192 | const char *getCC1Name(types::ID Type) const; |
| 193 | |
Daniel Dunbar | a3ec60e | 2009-03-29 18:40:18 +0000 | [diff] [blame] | 194 | void AddCC1Args(const ArgList &Args, ArgStringList &CmdArgs) const; |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 195 | void AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs, |
| 196 | const InputInfoList &Inputs, |
Daniel Dunbar | a3ec60e | 2009-03-29 18:40:18 +0000 | [diff] [blame] | 197 | const ArgStringList &OutputArgs) const; |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 198 | void AddCPPOptionsArgs(const ArgList &Args, ArgStringList &CmdArgs, |
| 199 | const InputInfoList &Inputs, |
Daniel Dunbar | a3ec60e | 2009-03-29 18:40:18 +0000 | [diff] [blame] | 200 | const ArgStringList &OutputArgs) const; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 201 | void AddCPPUniqueOptionsArgs(const ArgList &Args, |
Daniel Dunbar | a3ec60e | 2009-03-29 18:40:18 +0000 | [diff] [blame] | 202 | ArgStringList &CmdArgs, |
| 203 | const InputInfoList &Inputs) const; |
| 204 | void AddCPPArgs(const ArgList &Args, ArgStringList &CmdArgs) const; |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 205 | |
| 206 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 207 | CC1(const char *Name, const char *ShortName, |
| 208 | const ToolChain &TC) : DarwinTool(Name, ShortName, TC) {} |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 209 | |
| 210 | virtual bool acceptsPipedInput() const { return true; } |
| 211 | virtual bool canPipeOutput() const { return true; } |
Daniel Dunbar | 60a53f2 | 2010-04-06 17:07:49 +0000 | [diff] [blame] | 212 | virtual bool hasGoodDiagnostics() const { return true; } |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 213 | virtual bool hasIntegratedCPP() const { return true; } |
| 214 | }; |
| 215 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 216 | class LLVM_LIBRARY_VISIBILITY Preprocess : public CC1 { |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 217 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 218 | Preprocess(const ToolChain &TC) : CC1("darwin::Preprocess", |
| 219 | "gcc preprocessor", TC) {} |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 220 | |
| 221 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 222 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 223 | const InputInfo &Output, |
| 224 | const InputInfoList &Inputs, |
| 225 | const ArgList &TCArgs, |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 226 | const char *LinkingOutput) const; |
| 227 | }; |
| 228 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 229 | class LLVM_LIBRARY_VISIBILITY Compile : public CC1 { |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 230 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 231 | Compile(const ToolChain &TC) : CC1("darwin::Compile", "gcc frontend", TC) {} |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 232 | |
| 233 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 234 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 235 | const InputInfo &Output, |
| 236 | const InputInfoList &Inputs, |
| 237 | const ArgList &TCArgs, |
Daniel Dunbar | 40f1265 | 2009-03-29 17:08:39 +0000 | [diff] [blame] | 238 | const char *LinkingOutput) const; |
| 239 | }; |
| 240 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 241 | class LLVM_LIBRARY_VISIBILITY Assemble : public DarwinTool { |
Daniel Dunbar | 8cac5f7 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 242 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 243 | Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble", |
| 244 | "assembler", TC) {} |
Daniel Dunbar | 8cac5f7 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 245 | |
| 246 | virtual bool acceptsPipedInput() const { return true; } |
| 247 | virtual bool canPipeOutput() const { return false; } |
| 248 | virtual bool hasIntegratedCPP() const { return false; } |
| 249 | |
| 250 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 251 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 252 | const InputInfo &Output, |
| 253 | const InputInfoList &Inputs, |
| 254 | const ArgList &TCArgs, |
Daniel Dunbar | 8cac5f7 | 2009-03-20 16:06:39 +0000 | [diff] [blame] | 255 | const char *LinkingOutput) const; |
| 256 | }; |
| 257 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 258 | class LLVM_LIBRARY_VISIBILITY Link : public DarwinTool { |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 259 | void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const; |
| 260 | |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 261 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 262 | Link(const ToolChain &TC) : DarwinTool("darwin::Link", "linker", TC) {} |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 263 | |
| 264 | virtual bool acceptsPipedInput() const { return false; } |
| 265 | virtual bool canPipeOutput() const { return false; } |
| 266 | virtual bool hasIntegratedCPP() const { return false; } |
| 267 | |
| 268 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 269 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 270 | const InputInfo &Output, |
| 271 | const InputInfoList &Inputs, |
| 272 | const ArgList &TCArgs, |
Daniel Dunbar | 02633b5 | 2009-03-26 16:23:12 +0000 | [diff] [blame] | 273 | const char *LinkingOutput) const; |
| 274 | }; |
| 275 | |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 276 | class LLVM_LIBRARY_VISIBILITY Lipo : public DarwinTool { |
Daniel Dunbar | ff7488d | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 277 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 278 | Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", "lipo", TC) {} |
Daniel Dunbar | ff7488d | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 279 | |
| 280 | virtual bool acceptsPipedInput() const { return false; } |
| 281 | virtual bool canPipeOutput() const { return false; } |
| 282 | virtual bool hasIntegratedCPP() const { return false; } |
| 283 | |
| 284 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 285 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 286 | const InputInfo &Output, |
| 287 | const InputInfoList &Inputs, |
| 288 | const ArgList &TCArgs, |
Daniel Dunbar | ff7488d | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 289 | const char *LinkingOutput) const; |
| 290 | }; |
Daniel Dunbar | 6e0f254 | 2010-06-04 18:28:36 +0000 | [diff] [blame] | 291 | |
| 292 | class LLVM_LIBRARY_VISIBILITY Dsymutil : public DarwinTool { |
| 293 | public: |
| 294 | Dsymutil(const ToolChain &TC) : DarwinTool("darwin::Dsymutil", |
| 295 | "dsymutil", TC) {} |
| 296 | |
| 297 | virtual bool acceptsPipedInput() const { return false; } |
| 298 | virtual bool canPipeOutput() const { return false; } |
| 299 | virtual bool hasIntegratedCPP() const { return false; } |
| 300 | |
| 301 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 302 | Job &Dest, |
| 303 | const InputInfo &Output, |
| 304 | const InputInfoList &Inputs, |
| 305 | const ArgList &TCArgs, |
| 306 | const char *LinkingOutput) const; |
| 307 | }; |
Daniel Dunbar | ff7488d | 2009-03-20 00:52:38 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 310 | /// openbsd -- Directly call GNU Binutils assembler and linker |
| 311 | namespace openbsd { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 312 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 313 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 314 | Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler", |
| 315 | TC) {} |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 316 | |
| 317 | virtual bool acceptsPipedInput() const { return true; } |
| 318 | virtual bool canPipeOutput() const { return true; } |
| 319 | virtual bool hasIntegratedCPP() const { return false; } |
| 320 | |
| 321 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 322 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 323 | const InputInfo &Output, |
| 324 | const InputInfoList &Inputs, |
| 325 | const ArgList &TCArgs, |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 326 | const char *LinkingOutput) const; |
| 327 | }; |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 328 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 329 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 330 | Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {} |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 331 | |
| 332 | virtual bool acceptsPipedInput() const { return true; } |
| 333 | virtual bool canPipeOutput() const { return true; } |
| 334 | virtual bool hasIntegratedCPP() const { return false; } |
| 335 | |
| 336 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 337 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 338 | const InputInfo &Output, |
| 339 | const InputInfoList &Inputs, |
| 340 | const ArgList &TCArgs, |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 341 | const char *LinkingOutput) const; |
| 342 | }; |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 343 | } // end namespace openbsd |
Daniel Dunbar | f7b8eec | 2009-06-29 20:52:51 +0000 | [diff] [blame] | 344 | |
Daniel Dunbar | 68a31d4 | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 345 | /// freebsd -- Directly call GNU Binutils assembler and linker |
| 346 | namespace freebsd { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 347 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | 68a31d4 | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 348 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 349 | Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler", |
| 350 | TC) {} |
Daniel Dunbar | 68a31d4 | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 351 | |
| 352 | virtual bool acceptsPipedInput() const { return true; } |
| 353 | virtual bool canPipeOutput() const { return true; } |
| 354 | virtual bool hasIntegratedCPP() const { return false; } |
| 355 | |
| 356 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 357 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 358 | const InputInfo &Output, |
| 359 | const InputInfoList &Inputs, |
| 360 | const ArgList &TCArgs, |
Daniel Dunbar | 68a31d4 | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 361 | const char *LinkingOutput) const; |
| 362 | }; |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 363 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | 008f54a | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 364 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 365 | Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {} |
Daniel Dunbar | 008f54a | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 366 | |
| 367 | virtual bool acceptsPipedInput() const { return true; } |
| 368 | virtual bool canPipeOutput() const { return true; } |
| 369 | virtual bool hasIntegratedCPP() const { return false; } |
| 370 | |
| 371 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 372 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 373 | const InputInfo &Output, |
| 374 | const InputInfoList &Inputs, |
| 375 | const ArgList &TCArgs, |
Daniel Dunbar | 008f54a | 2009-04-01 19:36:32 +0000 | [diff] [blame] | 376 | const char *LinkingOutput) const; |
| 377 | }; |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 378 | } // end namespace freebsd |
| 379 | |
| 380 | /// auroraux -- Directly call GNU Binutils assembler and linker |
| 381 | namespace auroraux { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 382 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 383 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 384 | Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler", |
| 385 | TC) {} |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 386 | |
| 387 | virtual bool acceptsPipedInput() const { return true; } |
| 388 | virtual bool canPipeOutput() const { return true; } |
| 389 | virtual bool hasIntegratedCPP() const { return false; } |
| 390 | |
| 391 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 392 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 393 | const InputInfo &Output, |
| 394 | const InputInfoList &Inputs, |
| 395 | const ArgList &TCArgs, |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 396 | const char *LinkingOutput) const; |
| 397 | }; |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 398 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 399 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 400 | Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {} |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 401 | |
| 402 | virtual bool acceptsPipedInput() const { return true; } |
| 403 | virtual bool canPipeOutput() const { return true; } |
| 404 | virtual bool hasIntegratedCPP() const { return false; } |
| 405 | |
| 406 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 407 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 408 | const InputInfo &Output, |
| 409 | const InputInfoList &Inputs, |
| 410 | const ArgList &TCArgs, |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 411 | const char *LinkingOutput) const; |
| 412 | }; |
| 413 | } // end namespace auroraux |
Daniel Dunbar | 68a31d4 | 2009-03-31 17:45:15 +0000 | [diff] [blame] | 414 | |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 415 | /// dragonfly -- Directly call GNU Binutils assembler and linker |
| 416 | namespace dragonfly { |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 417 | class LLVM_LIBRARY_VISIBILITY Assemble : public Tool { |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 418 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 419 | Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler", |
| 420 | TC) {} |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 421 | |
| 422 | virtual bool acceptsPipedInput() const { return true; } |
| 423 | virtual bool canPipeOutput() const { return true; } |
| 424 | virtual bool hasIntegratedCPP() const { return false; } |
| 425 | |
| 426 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 427 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 428 | const InputInfo &Output, |
| 429 | const InputInfoList &Inputs, |
| 430 | const ArgList &TCArgs, |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 431 | const char *LinkingOutput) const; |
| 432 | }; |
Duncan Sands | 92dd191 | 2010-05-11 20:16:05 +0000 | [diff] [blame] | 433 | class LLVM_LIBRARY_VISIBILITY Link : public Tool { |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 434 | public: |
Daniel Dunbar | 3038204 | 2010-05-22 00:37:18 +0000 | [diff] [blame] | 435 | Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {} |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 436 | |
| 437 | virtual bool acceptsPipedInput() const { return true; } |
| 438 | virtual bool canPipeOutput() const { return true; } |
| 439 | virtual bool hasIntegratedCPP() const { return false; } |
| 440 | |
| 441 | virtual void ConstructJob(Compilation &C, const JobAction &JA, |
| 442 | Job &Dest, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 443 | const InputInfo &Output, |
| 444 | const InputInfoList &Inputs, |
| 445 | const ArgList &TCArgs, |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 446 | const char *LinkingOutput) const; |
| 447 | }; |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 448 | } // end namespace dragonfly |
Daniel Dunbar | 11e1b40 | 2009-05-02 18:28:39 +0000 | [diff] [blame] | 449 | |
Daniel Dunbar | 9c073ff | 2009-03-17 22:07:58 +0000 | [diff] [blame] | 450 | } // end namespace toolchains |
| 451 | } // end namespace driver |
| 452 | } // end namespace clang |
| 453 | |
Edward O'Callaghan | e7925a0 | 2009-08-22 01:06:46 +0000 | [diff] [blame] | 454 | #endif // CLANG_LIB_DRIVER_TOOLS_H_ |