• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
14 #include "clang/Driver/Types.h"
15 #include "clang/Driver/Util.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/Option/Option.h"
18 #include "llvm/Support/Compiler.h"
19 
20 namespace clang {
21   class ObjCRuntime;
22 
23 namespace driver {
24   class Command;
25   class Driver;
26 
27 namespace toolchains {
28   class MachO;
29 }
30 
31 namespace tools {
32 
33 namespace visualstudio {
34   class Compile;
35 }
36 
37 using llvm::opt::ArgStringList;
38 
39   /// \brief Clang compiler tool.
40   class LLVM_LIBRARY_VISIBILITY Clang : public Tool {
41   public:
42     static const char *getBaseInputName(const llvm::opt::ArgList &Args,
43                                         const InputInfoList &Inputs);
44     static const char *getBaseInputStem(const llvm::opt::ArgList &Args,
45                                         const InputInfoList &Inputs);
46     static const char *getDependencyFileName(const llvm::opt::ArgList &Args,
47                                              const InputInfoList &Inputs);
48 
49   private:
50     void AddPreprocessingOptions(Compilation &C, const JobAction &JA,
51                                  const Driver &D,
52                                  const llvm::opt::ArgList &Args,
53                                  llvm::opt::ArgStringList &CmdArgs,
54                                  const InputInfo &Output,
55                                  const InputInfoList &Inputs) const;
56 
57     void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
58                               llvm::opt::ArgStringList &CmdArgs) const;
59     void AddARMTargetArgs(const llvm::opt::ArgList &Args,
60                           llvm::opt::ArgStringList &CmdArgs,
61                           bool KernelOrKext) const;
62     void AddARM64TargetArgs(const llvm::opt::ArgList &Args,
63                             llvm::opt::ArgStringList &CmdArgs) const;
64     void AddMIPSTargetArgs(const llvm::opt::ArgList &Args,
65                            llvm::opt::ArgStringList &CmdArgs) const;
66     void AddR600TargetArgs(const llvm::opt::ArgList &Args,
67                            llvm::opt::ArgStringList &CmdArgs) const;
68     void AddSparcTargetArgs(const llvm::opt::ArgList &Args,
69                             llvm::opt::ArgStringList &CmdArgs) const;
70     void AddSystemZTargetArgs(const llvm::opt::ArgList &Args,
71                               llvm::opt::ArgStringList &CmdArgs) const;
72     void AddX86TargetArgs(const llvm::opt::ArgList &Args,
73                           llvm::opt::ArgStringList &CmdArgs) const;
74     void AddHexagonTargetArgs(const llvm::opt::ArgList &Args,
75                               llvm::opt::ArgStringList &CmdArgs) const;
76 
77     enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile };
78 
79     ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args,
80                                    llvm::opt::ArgStringList &cmdArgs,
81                                    RewriteKind rewrite) const;
82 
83     void AddClangCLArgs(const llvm::opt::ArgList &Args,
84                         llvm::opt::ArgStringList &CmdArgs) const;
85 
86     visualstudio::Compile *getCLFallback() const;
87 
88     mutable std::unique_ptr<visualstudio::Compile> CLFallback;
89 
90   public:
Clang(const ToolChain & TC)91     Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
92 
hasGoodDiagnostics()93     bool hasGoodDiagnostics() const override { return true; }
hasIntegratedAssembler()94     bool hasIntegratedAssembler() const override { return true; }
hasIntegratedCPP()95     bool hasIntegratedCPP() const override { return true; }
96 
97     void ConstructJob(Compilation &C, const JobAction &JA,
98                       const InputInfo &Output, const InputInfoList &Inputs,
99                       const llvm::opt::ArgList &TCArgs,
100                       const char *LinkingOutput) const override;
101   };
102 
103   /// \brief Clang integrated assembler tool.
104   class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
105   public:
ClangAs(const ToolChain & TC)106     ClangAs(const ToolChain &TC) : Tool("clang::as",
107                                         "clang integrated assembler", TC) {}
108 
hasGoodDiagnostics()109     bool hasGoodDiagnostics() const override { return true; }
hasIntegratedAssembler()110     bool hasIntegratedAssembler() const override { return false; }
hasIntegratedCPP()111     bool hasIntegratedCPP() const override { return false; }
112 
113     void ConstructJob(Compilation &C, const JobAction &JA,
114                       const InputInfo &Output, const InputInfoList &Inputs,
115                       const llvm::opt::ArgList &TCArgs,
116                       const char *LinkingOutput) const override;
117   };
118 
119   /// gcc - Generic GCC tool implementations.
120 namespace gcc {
121   class LLVM_LIBRARY_VISIBILITY Common : public Tool {
122   public:
Common(const char * Name,const char * ShortName,const ToolChain & TC)123     Common(const char *Name, const char *ShortName,
124            const ToolChain &TC) : Tool(Name, ShortName, TC) {}
125 
126     void ConstructJob(Compilation &C, const JobAction &JA,
127                       const InputInfo &Output,
128                       const InputInfoList &Inputs,
129                       const llvm::opt::ArgList &TCArgs,
130                       const char *LinkingOutput) const override;
131 
132     /// RenderExtraToolArgs - Render any arguments necessary to force
133     /// the particular tool mode.
134     virtual void
135         RenderExtraToolArgs(const JobAction &JA,
136                             llvm::opt::ArgStringList &CmdArgs) const = 0;
137   };
138 
139   class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
140   public:
Preprocess(const ToolChain & TC)141     Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
142                                              "gcc preprocessor", TC) {}
143 
hasGoodDiagnostics()144     bool hasGoodDiagnostics() const override { return true; }
hasIntegratedCPP()145     bool hasIntegratedCPP() const override { return false; }
146 
147     void RenderExtraToolArgs(const JobAction &JA,
148                              llvm::opt::ArgStringList &CmdArgs) const override;
149   };
150 
151   class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
152   public:
Compile(const ToolChain & TC)153     Compile(const ToolChain &TC) : Common("gcc::Compile",
154                                           "gcc frontend", TC) {}
155 
hasGoodDiagnostics()156     bool hasGoodDiagnostics() const override { return true; }
hasIntegratedCPP()157     bool hasIntegratedCPP() const override { return true; }
158 
159     void RenderExtraToolArgs(const JobAction &JA,
160                              llvm::opt::ArgStringList &CmdArgs) const override;
161   };
162 
163   class LLVM_LIBRARY_VISIBILITY Link : public Common  {
164   public:
Link(const ToolChain & TC)165     Link(const ToolChain &TC) : Common("gcc::Link",
166                                        "linker (via gcc)", TC) {}
167 
hasIntegratedCPP()168     bool hasIntegratedCPP() const override { return false; }
isLinkJob()169     bool isLinkJob() const override { return true; }
170 
171     void RenderExtraToolArgs(const JobAction &JA,
172                              llvm::opt::ArgStringList &CmdArgs) const override;
173   };
174 } // end namespace gcc
175 
176 namespace hexagon {
177   // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
178   // We simply use "clang -cc1" for those actions.
179   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
180   public:
Assemble(const ToolChain & TC)181     Assemble(const ToolChain &TC) : Tool("hexagon::Assemble",
182       "hexagon-as", TC) {}
183 
hasIntegratedCPP()184     bool hasIntegratedCPP() const override { return false; }
185 
186     void RenderExtraToolArgs(const JobAction &JA,
187                              llvm::opt::ArgStringList &CmdArgs) const;
188     void ConstructJob(Compilation &C, const JobAction &JA,
189                       const InputInfo &Output, const InputInfoList &Inputs,
190                       const llvm::opt::ArgList &TCArgs,
191                       const char *LinkingOutput) const override;
192   };
193 
194   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
195   public:
Link(const ToolChain & TC)196     Link(const ToolChain &TC) : Tool("hexagon::Link",
197       "hexagon-ld", TC) {}
198 
hasIntegratedCPP()199     bool hasIntegratedCPP() const override { return false; }
isLinkJob()200     bool isLinkJob() const override { return true; }
201 
202     virtual void RenderExtraToolArgs(const JobAction &JA,
203                                      llvm::opt::ArgStringList &CmdArgs) const;
204     void ConstructJob(Compilation &C, const JobAction &JA,
205                       const InputInfo &Output, const InputInfoList &Inputs,
206                       const llvm::opt::ArgList &TCArgs,
207                       const char *LinkingOutput) const override;
208   };
209 } // end namespace hexagon.
210 
211 namespace arm {
212   StringRef getARMTargetCPU(const llvm::opt::ArgList &Args,
213                             const llvm::Triple &Triple);
214   const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
215                                 const llvm::Triple &Triple);
216   const char* getLLVMArchSuffixForARM(StringRef CPU);
217 }
218 
219 namespace mips {
220   bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
221   bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
222 }
223 
224 namespace darwin {
225   llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
226   void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
227 
228   class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
229     virtual void anchor();
230   protected:
231     void AddMachOArch(const llvm::opt::ArgList &Args,
232                        llvm::opt::ArgStringList &CmdArgs) const;
233 
getMachOToolChain()234     const toolchains::MachO &getMachOToolChain() const {
235       return reinterpret_cast<const toolchains::MachO&>(getToolChain());
236     }
237 
238   public:
MachOTool(const char * Name,const char * ShortName,const ToolChain & TC)239     MachOTool(const char *Name, const char *ShortName,
240                const ToolChain &TC) : Tool(Name, ShortName, TC) {}
241   };
242 
243   class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool  {
244   public:
Assemble(const ToolChain & TC)245     Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
246                                               "assembler", TC) {}
247 
hasIntegratedCPP()248     bool hasIntegratedCPP() const override { return false; }
249 
250     void ConstructJob(Compilation &C, const JobAction &JA,
251                       const InputInfo &Output, const InputInfoList &Inputs,
252                       const llvm::opt::ArgList &TCArgs,
253                       const char *LinkingOutput) const override;
254   };
255 
256   class LLVM_LIBRARY_VISIBILITY Link : public MachOTool  {
257     bool NeedsTempPath(const InputInfoList &Inputs) const;
258     void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
259                      llvm::opt::ArgStringList &CmdArgs,
260                      const InputInfoList &Inputs) const;
261 
262   public:
Link(const ToolChain & TC)263     Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC) {}
264 
hasIntegratedCPP()265     bool hasIntegratedCPP() const override { return false; }
isLinkJob()266     bool isLinkJob() const override { return true; }
267 
268     void ConstructJob(Compilation &C, const JobAction &JA,
269                       const InputInfo &Output, const InputInfoList &Inputs,
270                       const llvm::opt::ArgList &TCArgs,
271                       const char *LinkingOutput) const override;
272   };
273 
274   class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool  {
275   public:
Lipo(const ToolChain & TC)276     Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
277 
hasIntegratedCPP()278     bool hasIntegratedCPP() const override { return false; }
279 
280     void ConstructJob(Compilation &C, const JobAction &JA,
281                       const InputInfo &Output, const InputInfoList &Inputs,
282                       const llvm::opt::ArgList &TCArgs,
283                       const char *LinkingOutput) const override;
284   };
285 
286   class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool  {
287   public:
Dsymutil(const ToolChain & TC)288     Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
289                                               "dsymutil", TC) {}
290 
hasIntegratedCPP()291     bool hasIntegratedCPP() const override { return false; }
isDsymutilJob()292     bool isDsymutilJob() const override { return true; }
293 
294     void ConstructJob(Compilation &C, const JobAction &JA,
295                       const InputInfo &Output,
296                       const InputInfoList &Inputs,
297                       const llvm::opt::ArgList &TCArgs,
298                       const char *LinkingOutput) const override;
299   };
300 
301   class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool  {
302   public:
VerifyDebug(const ToolChain & TC)303     VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
304                                                  "dwarfdump", TC) {}
305 
hasIntegratedCPP()306     bool hasIntegratedCPP() const override { return false; }
307 
308     void ConstructJob(Compilation &C, const JobAction &JA,
309                       const InputInfo &Output, const InputInfoList &Inputs,
310                       const llvm::opt::ArgList &TCArgs,
311                       const char *LinkingOutput) const override;
312   };
313 
314 }
315 
316   /// openbsd -- Directly call GNU Binutils assembler and linker
317 namespace openbsd {
318   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
319   public:
Assemble(const ToolChain & TC)320     Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler",
321                                          TC) {}
322 
hasIntegratedCPP()323     bool hasIntegratedCPP() const override { return false; }
324 
325     void ConstructJob(Compilation &C, const JobAction &JA,
326                       const InputInfo &Output,
327                       const InputInfoList &Inputs,
328                       const llvm::opt::ArgList &TCArgs,
329                       const char *LinkingOutput) const override;
330   };
331   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
332   public:
Link(const ToolChain & TC)333     Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {}
334 
hasIntegratedCPP()335     bool hasIntegratedCPP() const override { return false; }
isLinkJob()336     bool isLinkJob() const override { return true; }
337 
338     void ConstructJob(Compilation &C, const JobAction &JA,
339                       const InputInfo &Output, const InputInfoList &Inputs,
340                       const llvm::opt::ArgList &TCArgs,
341                       const char *LinkingOutput) const override;
342   };
343 } // end namespace openbsd
344 
345   /// bitrig -- Directly call GNU Binutils assembler and linker
346 namespace bitrig {
347   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
348   public:
Assemble(const ToolChain & TC)349     Assemble(const ToolChain &TC) : Tool("bitrig::Assemble", "assembler",
350                                          TC) {}
351 
hasIntegratedCPP()352     bool hasIntegratedCPP() const override { return false; }
353 
354     void ConstructJob(Compilation &C, const JobAction &JA,
355                       const InputInfo &Output, const InputInfoList &Inputs,
356                       const llvm::opt::ArgList &TCArgs,
357                       const char *LinkingOutput) const override;
358   };
359   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
360   public:
Link(const ToolChain & TC)361     Link(const ToolChain &TC) : Tool("bitrig::Link", "linker", TC) {}
362 
hasIntegratedCPP()363     bool hasIntegratedCPP() const override { return false; }
isLinkJob()364     bool isLinkJob() const override { return true; }
365 
366     void ConstructJob(Compilation &C, const JobAction &JA,
367                       const InputInfo &Output, const InputInfoList &Inputs,
368                       const llvm::opt::ArgList &TCArgs,
369                       const char *LinkingOutput) const override;
370   };
371 } // end namespace bitrig
372 
373   /// freebsd -- Directly call GNU Binutils assembler and linker
374 namespace freebsd {
375   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
376   public:
Assemble(const ToolChain & TC)377     Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler",
378                                          TC) {}
379 
hasIntegratedCPP()380     bool hasIntegratedCPP() const override { return false; }
381 
382     void ConstructJob(Compilation &C, const JobAction &JA,
383                       const InputInfo &Output, const InputInfoList &Inputs,
384                       const llvm::opt::ArgList &TCArgs,
385                       const char *LinkingOutput) const override;
386   };
387   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
388   public:
Link(const ToolChain & TC)389     Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {}
390 
hasIntegratedCPP()391     bool hasIntegratedCPP() const override { return false; }
isLinkJob()392     bool isLinkJob() const override { return true; }
393 
394     void ConstructJob(Compilation &C, const JobAction &JA,
395                       const InputInfo &Output, const InputInfoList &Inputs,
396                       const llvm::opt::ArgList &TCArgs,
397                       const char *LinkingOutput) const override;
398   };
399 } // end namespace freebsd
400 
401   /// netbsd -- Directly call GNU Binutils assembler and linker
402 namespace netbsd {
403   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
404 
405   public:
Assemble(const ToolChain & TC)406     Assemble(const ToolChain &TC)
407       : Tool("netbsd::Assemble", "assembler", TC) {}
408 
hasIntegratedCPP()409     bool hasIntegratedCPP() const override { return false; }
410 
411     void ConstructJob(Compilation &C, const JobAction &JA,
412                       const InputInfo &Output, const InputInfoList &Inputs,
413                       const llvm::opt::ArgList &TCArgs,
414                       const char *LinkingOutput) const override;
415   };
416   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
417 
418   public:
Link(const ToolChain & TC)419     Link(const ToolChain &TC)
420       : Tool("netbsd::Link", "linker", TC) {}
421 
hasIntegratedCPP()422     bool hasIntegratedCPP() const override { return false; }
isLinkJob()423     bool isLinkJob() const override { return true; }
424 
425     void ConstructJob(Compilation &C, const JobAction &JA,
426                       const InputInfo &Output, const InputInfoList &Inputs,
427                       const llvm::opt::ArgList &TCArgs,
428                       const char *LinkingOutput) const override;
429   };
430 } // end namespace netbsd
431 
432   /// Directly call GNU Binutils' assembler and linker.
433 namespace gnutools {
434   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
435   public:
Assemble(const ToolChain & TC)436     Assemble(const ToolChain &TC) : Tool("GNU::Assemble", "assembler", TC) {}
437 
hasIntegratedCPP()438     bool hasIntegratedCPP() const override { return false; }
439 
440     void ConstructJob(Compilation &C, const JobAction &JA,
441                       const InputInfo &Output,
442                       const InputInfoList &Inputs,
443                       const llvm::opt::ArgList &TCArgs,
444                       const char *LinkingOutput) const override;
445   };
446   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
447   public:
Link(const ToolChain & TC)448     Link(const ToolChain &TC) : Tool("GNU::Link", "linker", TC) {}
449 
hasIntegratedCPP()450     bool hasIntegratedCPP() const override { return false; }
isLinkJob()451     bool isLinkJob() const override { return true; }
452 
453     void ConstructJob(Compilation &C, const JobAction &JA,
454                       const InputInfo &Output,
455                       const InputInfoList &Inputs,
456                       const llvm::opt::ArgList &TCArgs,
457                       const char *LinkingOutput) const override;
458   };
459 }
460   /// minix -- Directly call GNU Binutils assembler and linker
461 namespace minix {
462   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
463   public:
Assemble(const ToolChain & TC)464     Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler",
465                                          TC) {}
466 
hasIntegratedCPP()467     bool hasIntegratedCPP() const override { return false; }
468 
469     void ConstructJob(Compilation &C, const JobAction &JA,
470                       const InputInfo &Output,
471                       const InputInfoList &Inputs,
472                       const llvm::opt::ArgList &TCArgs,
473                       const char *LinkingOutput) const override;
474   };
475   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
476   public:
Link(const ToolChain & TC)477     Link(const ToolChain &TC) : Tool("minix::Link", "linker", TC) {}
478 
hasIntegratedCPP()479     bool hasIntegratedCPP() const override { return false; }
isLinkJob()480     bool isLinkJob() const override { return true; }
481 
482     void ConstructJob(Compilation &C, const JobAction &JA,
483                       const InputInfo &Output,
484                       const InputInfoList &Inputs,
485                       const llvm::opt::ArgList &TCArgs,
486                       const char *LinkingOutput) const override;
487   };
488 } // end namespace minix
489 
490   /// solaris -- Directly call Solaris assembler and linker
491 namespace solaris {
492   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
493   public:
Assemble(const ToolChain & TC)494     Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
495                                          TC) {}
496 
hasIntegratedCPP()497     bool hasIntegratedCPP() const override { return false; }
498 
499     void ConstructJob(Compilation &C, const JobAction &JA,
500                       const InputInfo &Output, const InputInfoList &Inputs,
501                       const llvm::opt::ArgList &TCArgs,
502                       const char *LinkingOutput) const override;
503   };
504   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
505   public:
Link(const ToolChain & TC)506     Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {}
507 
hasIntegratedCPP()508     bool hasIntegratedCPP() const override { return false; }
isLinkJob()509     bool isLinkJob() const override { return true; }
510 
511     void ConstructJob(Compilation &C, const JobAction &JA,
512                       const InputInfo &Output, const InputInfoList &Inputs,
513                       const llvm::opt::ArgList &TCArgs,
514                       const char *LinkingOutput) const override;
515   };
516 } // end namespace solaris
517 
518   /// auroraux -- Directly call GNU Binutils assembler and linker
519 namespace auroraux {
520   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
521   public:
Assemble(const ToolChain & TC)522     Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler",
523                                          TC) {}
524 
hasIntegratedCPP()525     bool hasIntegratedCPP() const override { return false; }
526 
527     void ConstructJob(Compilation &C, const JobAction &JA,
528                       const InputInfo &Output, const InputInfoList &Inputs,
529                       const llvm::opt::ArgList &TCArgs,
530                       const char *LinkingOutput) const override;
531   };
532   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
533   public:
Link(const ToolChain & TC)534     Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {}
535 
hasIntegratedCPP()536     bool hasIntegratedCPP() const override { return false; }
isLinkJob()537     bool isLinkJob() const override { return true; }
538 
539     void ConstructJob(Compilation &C, const JobAction &JA,
540                       const InputInfo &Output, const InputInfoList &Inputs,
541                       const llvm::opt::ArgList &TCArgs,
542                       const char *LinkingOutput) const override;
543   };
544 } // end namespace auroraux
545 
546   /// dragonfly -- Directly call GNU Binutils assembler and linker
547 namespace dragonfly {
548   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
549   public:
Assemble(const ToolChain & TC)550     Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler",
551                                          TC) {}
552 
hasIntegratedCPP()553     bool hasIntegratedCPP() const override { return false; }
554 
555     void ConstructJob(Compilation &C, const JobAction &JA,
556                       const InputInfo &Output, const InputInfoList &Inputs,
557                       const llvm::opt::ArgList &TCArgs,
558                       const char *LinkingOutput) const override;
559   };
560   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
561   public:
Link(const ToolChain & TC)562     Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {}
563 
hasIntegratedCPP()564     bool hasIntegratedCPP() const override { return false; }
isLinkJob()565     bool isLinkJob() const override { return true; }
566 
567     void ConstructJob(Compilation &C, const JobAction &JA,
568                       const InputInfo &Output,
569                       const InputInfoList &Inputs,
570                       const llvm::opt::ArgList &TCArgs,
571                       const char *LinkingOutput) const override;
572   };
573 } // end namespace dragonfly
574 
575 /// Visual studio tools.
576 namespace visualstudio {
577   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
578   public:
Link(const ToolChain & TC)579     Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC) {}
580 
hasIntegratedCPP()581     bool hasIntegratedCPP() const override { return false; }
isLinkJob()582     bool isLinkJob() const override { return true; }
583 
584     void ConstructJob(Compilation &C, const JobAction &JA,
585                       const InputInfo &Output, const InputInfoList &Inputs,
586                       const llvm::opt::ArgList &TCArgs,
587                       const char *LinkingOutput) const override;
588   };
589 
590   class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
591   public:
Compile(const ToolChain & TC)592     Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC) {}
593 
hasIntegratedAssembler()594     bool hasIntegratedAssembler() const override { return true; }
hasIntegratedCPP()595     bool hasIntegratedCPP() const override { return true; }
isLinkJob()596     bool isLinkJob() const override { return false; }
597 
598     void ConstructJob(Compilation &C, const JobAction &JA,
599                       const InputInfo &Output, const InputInfoList &Inputs,
600                       const llvm::opt::ArgList &TCArgs,
601                       const char *LinkingOutput) const override;
602 
603     Command *GetCommand(Compilation &C, const JobAction &JA,
604                         const InputInfo &Output,
605                         const InputInfoList &Inputs,
606                         const llvm::opt::ArgList &TCArgs,
607                         const char *LinkingOutput) const;
608   };
609 } // end namespace visualstudio
610 
611 namespace arm {
612   StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
613                          const llvm::Triple &Triple);
614 }
615 namespace XCore {
616   // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
617   // We simply use "clang -cc1" for those actions.
618   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
619   public:
Assemble(const ToolChain & TC)620     Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
621       "XCore-as", TC) {}
622 
hasIntegratedCPP()623     bool hasIntegratedCPP() const override { return false; }
624     void ConstructJob(Compilation &C, const JobAction &JA,
625                       const InputInfo &Output, const InputInfoList &Inputs,
626                       const llvm::opt::ArgList &TCArgs,
627                       const char *LinkingOutput) const override;
628   };
629 
630   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
631   public:
Link(const ToolChain & TC)632     Link(const ToolChain &TC) : Tool("XCore::Link",
633       "XCore-ld", TC) {}
634 
hasIntegratedCPP()635     bool hasIntegratedCPP() const override { return false; }
isLinkJob()636     bool isLinkJob() const override { return true; }
637     void ConstructJob(Compilation &C, const JobAction &JA,
638                       const InputInfo &Output, const InputInfoList &Inputs,
639                       const llvm::opt::ArgList &TCArgs,
640                       const char *LinkingOutput) const override;
641   };
642 } // end namespace XCore.
643 
644 
645 } // end namespace toolchains
646 } // end namespace driver
647 } // end namespace clang
648 
649 #endif // CLANG_LIB_DRIVER_TOOLS_H_
650