blob: c06e22b1d55e79aa3cac24c5c69fd77900fba377 [file] [log] [blame]
Daniel Dunbar5903d8c2009-03-17 22:07:58 +00001//===--- 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 Dunbare6adeee2009-03-29 17:08:39 +000014#include "clang/Driver/Types.h"
Daniel Dunbara3246a02009-03-18 08:07:30 +000015#include "clang/Driver/Util.h"
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000016
Joerg Sonnenberger637603a2011-05-16 13:35:02 +000017#include "llvm/ADT/Triple.h"
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000018#include "llvm/Support/Compiler.h"
19
20namespace clang {
21namespace driver {
Douglas Gregor111af7d2009-04-18 00:34:01 +000022 class Driver;
23
Daniel Dunbarc1964212009-03-26 16:23:12 +000024namespace toolchains {
Daniel Dunbarf0a5b9b2009-09-04 18:34:51 +000025 class Darwin;
Daniel Dunbarc1964212009-03-26 16:23:12 +000026}
27
Daniel Dunbar15abb2e2009-03-17 22:18:43 +000028namespace tools {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000029
Daniel Dunbar4f5e79c2010-05-20 21:30:13 +000030 /// \brief Clang compiler tool.
Duncan Sandsaf260b92010-05-11 20:16:05 +000031 class LLVM_LIBRARY_VISIBILITY Clang : public Tool {
Peter Collingbourne9b515cb2011-11-06 00:40:05 +000032 void AddPreprocessingOptions(Compilation &C,
33 const Driver &D,
Douglas Gregor111af7d2009-04-18 00:34:01 +000034 const ArgList &Args,
Daniel Dunbard067f7f2009-04-08 23:54:23 +000035 ArgStringList &CmdArgs,
36 const InputInfo &Output,
37 const InputInfoList &Inputs) const;
38
Daniel Dunbarc9388c12011-03-17 17:10:06 +000039 void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs,
40 bool KernelOrKext) const;
Eric Christopher0b26a612010-03-02 02:41:08 +000041 void AddMIPSTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
Bruno Cardoso Lopese7f211c2010-11-09 17:21:19 +000042 void AddSparcTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
Daniel Dunbar3b3191f2009-09-09 22:33:08 +000043 void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
Tony Linthicum76329bf2011-12-12 21:14:55 +000044 void AddHexagonTargetArgs (const ArgList &Args, ArgStringList &CmdArgs) const;
Daniel Dunbar3b3191f2009-09-09 22:33:08 +000045
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000046 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +000047 Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000048
Daniel Dunbar3d45e172010-04-06 17:07:49 +000049 virtual bool hasGoodDiagnostics() const { return true; }
Daniel Dunbarc4343942010-02-03 03:07:56 +000050 virtual bool hasIntegratedAssembler() const { return true; }
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000051 virtual bool hasIntegratedCPP() const { return true; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +000052
53 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +000054 const InputInfo &Output,
55 const InputInfoList &Inputs,
56 const ArgList &TCArgs,
Daniel Dunbar1a093d22009-03-18 06:00:36 +000057 const char *LinkingOutput) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000058 };
59
Daniel Dunbar4f5e79c2010-05-20 21:30:13 +000060 /// \brief Clang integrated assembler tool.
61 class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
62 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +000063 ClangAs(const ToolChain &TC) : Tool("clang::as",
64 "clang integrated assembler", TC) {}
Daniel Dunbar4f5e79c2010-05-20 21:30:13 +000065
Daniel Dunbar4f5e79c2010-05-20 21:30:13 +000066 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,
Daniel Dunbar4f5e79c2010-05-20 21:30:13 +000071 const InputInfo &Output,
72 const InputInfoList &Inputs,
73 const ArgList &TCArgs,
74 const char *LinkingOutput) const;
75 };
76
Daniel Dunbar82116f82009-03-17 22:45:24 +000077 /// gcc - Generic GCC tool implementations.
78namespace gcc {
Duncan Sandsaf260b92010-05-11 20:16:05 +000079 class LLVM_LIBRARY_VISIBILITY Common : public Tool {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +000080 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +000081 Common(const char *Name, const char *ShortName,
82 const ToolChain &TC) : Tool(Name, ShortName, TC) {}
Daniel Dunbara3246a02009-03-18 08:07:30 +000083
84 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +000085 const InputInfo &Output,
86 const InputInfoList &Inputs,
87 const ArgList &TCArgs,
Daniel Dunbara3246a02009-03-18 08:07:30 +000088 const char *LinkingOutput) const;
89
90 /// RenderExtraToolArgs - Render any arguments necessary to force
91 /// the particular tool mode.
Daniel Dunbar4e295052010-01-25 22:35:08 +000092 virtual void RenderExtraToolArgs(const JobAction &JA,
93 ArgStringList &CmdArgs) const = 0;
Daniel Dunbara3246a02009-03-18 08:07:30 +000094 };
95
Mike Stump11289f42009-09-09 15:08:12 +000096
Duncan Sandsaf260b92010-05-11 20:16:05 +000097 class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
Daniel Dunbara3246a02009-03-18 08:07:30 +000098 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +000099 Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
100 "gcc preprocessor", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000101
Daniel Dunbar3d45e172010-04-06 17:07:49 +0000102 virtual bool hasGoodDiagnostics() const { return true; }
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000103 virtual bool hasIntegratedCPP() const { return false; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +0000104
Daniel Dunbar4e295052010-01-25 22:35:08 +0000105 virtual void RenderExtraToolArgs(const JobAction &JA,
106 ArgStringList &CmdArgs) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000107 };
108
Duncan Sandsaf260b92010-05-11 20:16:05 +0000109 class LLVM_LIBRARY_VISIBILITY Precompile : public Common {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000110 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000111 Precompile(const ToolChain &TC) : Common("gcc::Precompile",
112 "gcc precompile", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000113
Daniel Dunbar3d45e172010-04-06 17:07:49 +0000114 virtual bool hasGoodDiagnostics() const { return true; }
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000115 virtual bool hasIntegratedCPP() const { return true; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +0000116
Daniel Dunbar4e295052010-01-25 22:35:08 +0000117 virtual void RenderExtraToolArgs(const JobAction &JA,
118 ArgStringList &CmdArgs) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000119 };
120
Duncan Sandsaf260b92010-05-11 20:16:05 +0000121 class LLVM_LIBRARY_VISIBILITY Compile : public Common {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000122 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000123 Compile(const ToolChain &TC) : Common("gcc::Compile",
124 "gcc frontend", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000125
Daniel Dunbar3d45e172010-04-06 17:07:49 +0000126 virtual bool hasGoodDiagnostics() const { return true; }
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000127 virtual bool hasIntegratedCPP() const { return true; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +0000128
Daniel Dunbar4e295052010-01-25 22:35:08 +0000129 virtual void RenderExtraToolArgs(const JobAction &JA,
130 ArgStringList &CmdArgs) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000131 };
132
Duncan Sandsaf260b92010-05-11 20:16:05 +0000133 class LLVM_LIBRARY_VISIBILITY Assemble : public Common {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000134 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000135 Assemble(const ToolChain &TC) : Common("gcc::Assemble",
136 "assembler (via gcc)", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000137
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000138 virtual bool hasIntegratedCPP() const { return false; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +0000139
Daniel Dunbar4e295052010-01-25 22:35:08 +0000140 virtual void RenderExtraToolArgs(const JobAction &JA,
141 ArgStringList &CmdArgs) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000142 };
143
Duncan Sandsaf260b92010-05-11 20:16:05 +0000144 class LLVM_LIBRARY_VISIBILITY Link : public Common {
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000145 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000146 Link(const ToolChain &TC) : Common("gcc::Link",
147 "linker (via gcc)", TC) {}
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000148
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000149 virtual bool hasIntegratedCPP() const { return false; }
Daniel Dunbar1a093d22009-03-18 06:00:36 +0000150
Daniel Dunbar4e295052010-01-25 22:35:08 +0000151 virtual void RenderExtraToolArgs(const JobAction &JA,
152 ArgStringList &CmdArgs) const;
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000153 };
Daniel Dunbar82116f82009-03-17 22:45:24 +0000154} // end namespace gcc
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000155
Tony Linthicum76329bf2011-12-12 21:14:55 +0000156namespace hexagon {
157 // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
158 // We simply use "clang -cc1" for those actions.
159 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
160 public:
161 Assemble(const ToolChain &TC) : Tool("hexagon::Assemble",
162 "hexagon-as", TC) {}
163
164 virtual bool hasIntegratedCPP() const { return false; }
165
166 virtual void RenderExtraToolArgs(const JobAction &JA,
167 ArgStringList &CmdArgs) const;
168 virtual void ConstructJob(Compilation &C, const JobAction &JA,
169 const InputInfo &Output,
170 const InputInfoList &Inputs,
171 const ArgList &TCArgs,
172 const char *LinkingOutput) const;
173 };
174
175 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
176 public:
177 Link(const ToolChain &TC) : Tool("hexagon::Link",
178 "hexagon-ld", TC) {}
179
180 virtual bool hasIntegratedCPP() const { return false; }
181
182 virtual void RenderExtraToolArgs(const JobAction &JA,
183 ArgStringList &CmdArgs) const;
184 virtual void ConstructJob(Compilation &C, const JobAction &JA,
185 const InputInfo &Output,
186 const InputInfoList &Inputs,
187 const ArgList &TCArgs,
188 const char *LinkingOutput) const;
189 };
190} // end namespace hexagon.
191
192
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000193namespace darwin {
Duncan Sandsaf260b92010-05-11 20:16:05 +0000194 class LLVM_LIBRARY_VISIBILITY DarwinTool : public Tool {
Daniel Dunbare9ded432009-09-09 18:36:20 +0000195 protected:
196 void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const;
Daniel Dunbare9ded432009-09-09 18:36:20 +0000197
198 const toolchains::Darwin &getDarwinToolChain() const {
199 return reinterpret_cast<const toolchains::Darwin&>(getToolChain());
200 }
201
202 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000203 DarwinTool(const char *Name, const char *ShortName,
204 const ToolChain &TC) : Tool(Name, ShortName, TC) {}
Daniel Dunbare9ded432009-09-09 18:36:20 +0000205 };
206
Duncan Sandsaf260b92010-05-11 20:16:05 +0000207 class LLVM_LIBRARY_VISIBILITY CC1 : public DarwinTool {
Daniel Dunbar52e96cc2009-03-30 00:34:04 +0000208 public:
Mike Stump11289f42009-09-09 15:08:12 +0000209 static const char *getBaseInputName(const ArgList &Args,
Daniel Dunbar52e96cc2009-03-30 00:34:04 +0000210 const InputInfoList &Input);
Mike Stump11289f42009-09-09 15:08:12 +0000211 static const char *getBaseInputStem(const ArgList &Args,
Daniel Dunbar52e96cc2009-03-30 00:34:04 +0000212 const InputInfoList &Input);
Mike Stump11289f42009-09-09 15:08:12 +0000213 static const char *getDependencyFileName(const ArgList &Args,
Daniel Dunbar52e96cc2009-03-30 00:34:04 +0000214 const InputInfoList &Inputs);
215
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000216 protected:
217 const char *getCC1Name(types::ID Type) const;
218
Daniel Dunbarafec1f52009-03-29 18:40:18 +0000219 void AddCC1Args(const ArgList &Args, ArgStringList &CmdArgs) const;
Chad Rosierbc5ea3d2011-08-17 18:24:55 +0000220 void RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const;
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000221 void AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
222 const InputInfoList &Inputs,
Daniel Dunbarafec1f52009-03-29 18:40:18 +0000223 const ArgStringList &OutputArgs) const;
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000224 void AddCPPOptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
225 const InputInfoList &Inputs,
Daniel Dunbarafec1f52009-03-29 18:40:18 +0000226 const ArgStringList &OutputArgs) const;
Mike Stump11289f42009-09-09 15:08:12 +0000227 void AddCPPUniqueOptionsArgs(const ArgList &Args,
Daniel Dunbarafec1f52009-03-29 18:40:18 +0000228 ArgStringList &CmdArgs,
229 const InputInfoList &Inputs) const;
230 void AddCPPArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000231
232 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000233 CC1(const char *Name, const char *ShortName,
234 const ToolChain &TC) : DarwinTool(Name, ShortName, TC) {}
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000235
Daniel Dunbar3d45e172010-04-06 17:07:49 +0000236 virtual bool hasGoodDiagnostics() const { return true; }
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000237 virtual bool hasIntegratedCPP() const { return true; }
238 };
239
Duncan Sandsaf260b92010-05-11 20:16:05 +0000240 class LLVM_LIBRARY_VISIBILITY Preprocess : public CC1 {
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000241 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000242 Preprocess(const ToolChain &TC) : CC1("darwin::Preprocess",
243 "gcc preprocessor", TC) {}
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000244
245 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000246 const InputInfo &Output,
247 const InputInfoList &Inputs,
248 const ArgList &TCArgs,
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000249 const char *LinkingOutput) const;
250 };
251
Duncan Sandsaf260b92010-05-11 20:16:05 +0000252 class LLVM_LIBRARY_VISIBILITY Compile : public CC1 {
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000253 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000254 Compile(const ToolChain &TC) : CC1("darwin::Compile", "gcc frontend", TC) {}
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000255
256 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000257 const InputInfo &Output,
258 const InputInfoList &Inputs,
259 const ArgList &TCArgs,
Daniel Dunbare6adeee2009-03-29 17:08:39 +0000260 const char *LinkingOutput) const;
261 };
262
Duncan Sandsaf260b92010-05-11 20:16:05 +0000263 class LLVM_LIBRARY_VISIBILITY Assemble : public DarwinTool {
Daniel Dunbarbe220842009-03-20 16:06:39 +0000264 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000265 Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble",
266 "assembler", TC) {}
Daniel Dunbarbe220842009-03-20 16:06:39 +0000267
Daniel Dunbarbe220842009-03-20 16:06:39 +0000268 virtual bool hasIntegratedCPP() const { return false; }
269
270 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000271 const InputInfo &Output,
272 const InputInfoList &Inputs,
273 const ArgList &TCArgs,
Daniel Dunbarbe220842009-03-20 16:06:39 +0000274 const char *LinkingOutput) const;
275 };
276
Duncan Sandsaf260b92010-05-11 20:16:05 +0000277 class LLVM_LIBRARY_VISIBILITY Link : public DarwinTool {
Daniel Dunbarccbc4522010-09-09 21:51:05 +0000278 void AddLinkArgs(Compilation &C, const ArgList &Args,
279 ArgStringList &CmdArgs) const;
Daniel Dunbarc1964212009-03-26 16:23:12 +0000280
Daniel Dunbarc1964212009-03-26 16:23:12 +0000281 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000282 Link(const ToolChain &TC) : DarwinTool("darwin::Link", "linker", TC) {}
Daniel Dunbarc1964212009-03-26 16:23:12 +0000283
Daniel Dunbarc1964212009-03-26 16:23:12 +0000284 virtual bool hasIntegratedCPP() const { return false; }
285
286 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000287 const InputInfo &Output,
288 const InputInfoList &Inputs,
289 const ArgList &TCArgs,
Daniel Dunbarc1964212009-03-26 16:23:12 +0000290 const char *LinkingOutput) const;
291 };
292
Duncan Sandsaf260b92010-05-11 20:16:05 +0000293 class LLVM_LIBRARY_VISIBILITY Lipo : public DarwinTool {
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000294 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000295 Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", "lipo", TC) {}
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000296
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000297 virtual bool hasIntegratedCPP() const { return false; }
298
299 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000300 const InputInfo &Output,
301 const InputInfoList &Inputs,
302 const ArgList &TCArgs,
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000303 const char *LinkingOutput) const;
304 };
Daniel Dunbar88299622010-06-04 18:28:36 +0000305
306 class LLVM_LIBRARY_VISIBILITY Dsymutil : public DarwinTool {
307 public:
308 Dsymutil(const ToolChain &TC) : DarwinTool("darwin::Dsymutil",
309 "dsymutil", TC) {}
310
Daniel Dunbar88299622010-06-04 18:28:36 +0000311 virtual bool hasIntegratedCPP() const { return false; }
312
313 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Daniel Dunbar88299622010-06-04 18:28:36 +0000314 const InputInfo &Output,
315 const InputInfoList &Inputs,
316 const ArgList &TCArgs,
317 const char *LinkingOutput) const;
318 };
Eric Christopher551ef452011-08-23 17:56:55 +0000319
320 class LLVM_LIBRARY_VISIBILITY VerifyDebug : public DarwinTool {
321 public:
322 VerifyDebug(const ToolChain &TC) : DarwinTool("darwin::VerifyDebug",
323 "dwarfdump", TC) {}
324
325 virtual bool hasIntegratedCPP() const { return false; }
326
327 virtual void ConstructJob(Compilation &C, const JobAction &JA,
328 const InputInfo &Output,
329 const InputInfoList &Inputs,
330 const ArgList &TCArgs,
331 const char *LinkingOutput) const;
332 };
333
Daniel Dunbar64ed5e32009-03-20 00:52:38 +0000334}
335
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000336 /// openbsd -- Directly call GNU Binutils assembler and linker
337namespace openbsd {
Duncan Sandsaf260b92010-05-11 20:16:05 +0000338 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000339 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000340 Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler",
341 TC) {}
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000342
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000343 virtual bool hasIntegratedCPP() const { return false; }
344
345 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000346 const InputInfo &Output,
347 const InputInfoList &Inputs,
348 const ArgList &TCArgs,
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000349 const char *LinkingOutput) const;
350 };
Duncan Sandsaf260b92010-05-11 20:16:05 +0000351 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000352 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000353 Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {}
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000354
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000355 virtual bool hasIntegratedCPP() const { return false; }
356
357 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000358 const InputInfo &Output,
359 const InputInfoList &Inputs,
360 const ArgList &TCArgs,
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000361 const char *LinkingOutput) const;
362 };
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000363} // end namespace openbsd
Daniel Dunbar10de9e62009-06-29 20:52:51 +0000364
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000365 /// freebsd -- Directly call GNU Binutils assembler and linker
366namespace freebsd {
Duncan Sandsaf260b92010-05-11 20:16:05 +0000367 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000368 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000369 Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler",
370 TC) {}
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000371
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000372 virtual bool hasIntegratedCPP() const { return false; }
373
374 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000375 const InputInfo &Output,
376 const InputInfoList &Inputs,
377 const ArgList &TCArgs,
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000378 const char *LinkingOutput) const;
379 };
Duncan Sandsaf260b92010-05-11 20:16:05 +0000380 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
Daniel Dunbard854c8d2009-04-01 19:36:32 +0000381 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000382 Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {}
Daniel Dunbard854c8d2009-04-01 19:36:32 +0000383
Daniel Dunbard854c8d2009-04-01 19:36:32 +0000384 virtual bool hasIntegratedCPP() const { return false; }
385
386 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000387 const InputInfo &Output,
388 const InputInfoList &Inputs,
389 const ArgList &TCArgs,
Daniel Dunbard854c8d2009-04-01 19:36:32 +0000390 const char *LinkingOutput) const;
391 };
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000392} // end namespace freebsd
393
Benjamin Kramer24f1d3e2011-02-02 18:59:27 +0000394 /// netbsd -- Directly call GNU Binutils assembler and linker
395namespace netbsd {
396 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
Joerg Sonnenberger637603a2011-05-16 13:35:02 +0000397 private:
398 const llvm::Triple ToolTriple;
399
Benjamin Kramer24f1d3e2011-02-02 18:59:27 +0000400 public:
Joerg Sonnenberger637603a2011-05-16 13:35:02 +0000401 Assemble(const ToolChain &TC, const llvm::Triple &ToolTriple)
402 : Tool("netbsd::Assemble", "assembler", TC), ToolTriple(ToolTriple) {}
Benjamin Kramer24f1d3e2011-02-02 18:59:27 +0000403
404 virtual bool hasIntegratedCPP() const { return false; }
405
406 virtual void ConstructJob(Compilation &C, const JobAction &JA,
407 const InputInfo &Output,
408 const InputInfoList &Inputs,
409 const ArgList &TCArgs,
410 const char *LinkingOutput) const;
411 };
412 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
Joerg Sonnenberger637603a2011-05-16 13:35:02 +0000413 private:
414 const llvm::Triple ToolTriple;
415
Benjamin Kramer24f1d3e2011-02-02 18:59:27 +0000416 public:
Joerg Sonnenberger637603a2011-05-16 13:35:02 +0000417 Link(const ToolChain &TC, const llvm::Triple &ToolTriple)
Joerg Sonnenberger4eb724f2011-06-21 08:45:08 +0000418 : Tool("netbsd::Link", "linker", TC), ToolTriple(ToolTriple) {}
Benjamin Kramer24f1d3e2011-02-02 18:59:27 +0000419
420 virtual bool hasIntegratedCPP() const { return false; }
421
422 virtual void ConstructJob(Compilation &C, const JobAction &JA,
423 const InputInfo &Output,
424 const InputInfoList &Inputs,
425 const ArgList &TCArgs,
426 const char *LinkingOutput) const;
427 };
428} // end namespace netbsd
429
Rafael Espindola92b00932010-08-10 00:25:48 +0000430 /// linux -- Directly call GNU Binutils assembler and linker
431namespace linuxtools {
432 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
433 public:
434 Assemble(const ToolChain &TC) : Tool("linux::Assemble", "assembler",
435 TC) {}
436
437 virtual bool hasIntegratedCPP() const { return false; }
438
439 virtual void ConstructJob(Compilation &C, const JobAction &JA,
440 const InputInfo &Output,
441 const InputInfoList &Inputs,
442 const ArgList &TCArgs,
443 const char *LinkingOutput) const;
444 };
Rafael Espindolac8f008f2010-11-07 20:14:31 +0000445 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
446 public:
447 Link(const ToolChain &TC) : Tool("linux::Link", "linker", TC) {}
448
449 virtual bool hasIntegratedCPP() const { return false; }
450
451 virtual void ConstructJob(Compilation &C, const JobAction &JA,
452 const InputInfo &Output,
453 const InputInfoList &Inputs,
454 const ArgList &TCArgs,
455 const char *LinkingOutput) const;
456 };
Rafael Espindola92b00932010-08-10 00:25:48 +0000457}
Chris Lattner3e2ee142010-07-07 16:01:42 +0000458 /// minix -- Directly call GNU Binutils assembler and linker
459namespace minix {
460 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
461 public:
462 Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler",
463 TC) {}
464
Chris Lattner3e2ee142010-07-07 16:01:42 +0000465 virtual bool hasIntegratedCPP() const { return false; }
466
467 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Chris Lattner3e2ee142010-07-07 16:01:42 +0000468 const InputInfo &Output,
469 const InputInfoList &Inputs,
470 const ArgList &TCArgs,
471 const char *LinkingOutput) const;
472 };
473 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
474 public:
475 Link(const ToolChain &TC) : Tool("minix::Link", "linker", TC) {}
476
Chris Lattner3e2ee142010-07-07 16:01:42 +0000477 virtual bool hasIntegratedCPP() const { return false; }
478
479 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Chris Lattner3e2ee142010-07-07 16:01:42 +0000480 const InputInfo &Output,
481 const InputInfoList &Inputs,
482 const ArgList &TCArgs,
483 const char *LinkingOutput) const;
484 };
485} // end namespace minix
486
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000487 /// auroraux -- Directly call GNU Binutils assembler and linker
488namespace auroraux {
Duncan Sandsaf260b92010-05-11 20:16:05 +0000489 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000490 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000491 Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler",
492 TC) {}
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000493
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000494 virtual bool hasIntegratedCPP() const { return false; }
495
496 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000497 const InputInfo &Output,
498 const InputInfoList &Inputs,
499 const ArgList &TCArgs,
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000500 const char *LinkingOutput) const;
501 };
Duncan Sandsaf260b92010-05-11 20:16:05 +0000502 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000503 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000504 Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {}
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000505
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000506 virtual bool hasIntegratedCPP() const { return false; }
507
508 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000509 const InputInfo &Output,
510 const InputInfoList &Inputs,
511 const ArgList &TCArgs,
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000512 const char *LinkingOutput) const;
513 };
514} // end namespace auroraux
Daniel Dunbar8eb473c2009-03-31 17:45:15 +0000515
Daniel Dunbarcc912342009-05-02 18:28:39 +0000516 /// dragonfly -- Directly call GNU Binutils assembler and linker
517namespace dragonfly {
Duncan Sandsaf260b92010-05-11 20:16:05 +0000518 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
Daniel Dunbarcc912342009-05-02 18:28:39 +0000519 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000520 Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler",
521 TC) {}
Daniel Dunbarcc912342009-05-02 18:28:39 +0000522
Daniel Dunbarcc912342009-05-02 18:28:39 +0000523 virtual bool hasIntegratedCPP() const { return false; }
524
525 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000526 const InputInfo &Output,
527 const InputInfoList &Inputs,
528 const ArgList &TCArgs,
Daniel Dunbarcc912342009-05-02 18:28:39 +0000529 const char *LinkingOutput) const;
530 };
Duncan Sandsaf260b92010-05-11 20:16:05 +0000531 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
Daniel Dunbarcc912342009-05-02 18:28:39 +0000532 public:
Daniel Dunbar1cb532c2010-05-22 00:37:18 +0000533 Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {}
Daniel Dunbarcc912342009-05-02 18:28:39 +0000534
Daniel Dunbarcc912342009-05-02 18:28:39 +0000535 virtual bool hasIntegratedCPP() const { return false; }
536
537 virtual void ConstructJob(Compilation &C, const JobAction &JA,
Mike Stump11289f42009-09-09 15:08:12 +0000538 const InputInfo &Output,
539 const InputInfoList &Inputs,
540 const ArgList &TCArgs,
Daniel Dunbarcc912342009-05-02 18:28:39 +0000541 const char *LinkingOutput) const;
542 };
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000543} // end namespace dragonfly
Daniel Dunbarcc912342009-05-02 18:28:39 +0000544
Michael J. Spencerb186bc32010-08-21 21:55:07 +0000545 /// Visual studio tools.
546namespace visualstudio {
547 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
548 public:
549 Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC) {}
550
551 virtual bool hasIntegratedCPP() const { return false; }
552
553 virtual void ConstructJob(Compilation &C, const JobAction &JA,
554 const InputInfo &Output,
555 const InputInfoList &Inputs,
556 const ArgList &TCArgs,
557 const char *LinkingOutput) const;
558 };
559} // end namespace visualstudio
560
Daniel Dunbar5903d8c2009-03-17 22:07:58 +0000561} // end namespace toolchains
562} // end namespace driver
563} // end namespace clang
564
Edward O'Callaghan856e4ff2009-08-22 01:06:46 +0000565#endif // CLANG_LIB_DRIVER_TOOLS_H_