]> granicus.if.org Git - clang/blob - lib/Driver/Tools.h
Driver: add a cygwin linker tool
[clang] / lib / Driver / Tools.h
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:
91     Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
92
93     bool hasGoodDiagnostics() const override { return true; }
94     bool hasIntegratedAssembler() const override { return true; }
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:
106     ClangAs(const ToolChain &TC) : Tool("clang::as",
107                                         "clang integrated assembler", TC) {}
108
109     bool hasGoodDiagnostics() const override { return true; }
110     bool hasIntegratedAssembler() const override { return false; }
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:
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:
141     Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
142                                              "gcc preprocessor", TC) {}
143
144     bool hasGoodDiagnostics() const override { return true; }
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:
153     Compile(const ToolChain &TC) : Common("gcc::Compile",
154                                           "gcc frontend", TC) {}
155
156     bool hasGoodDiagnostics() const override { return true; }
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:
165     Link(const ToolChain &TC) : Common("gcc::Link",
166                                        "linker (via gcc)", TC) {}
167
168     bool hasIntegratedCPP() const override { return false; }
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:
181     Assemble(const ToolChain &TC) : Tool("hexagon::Assemble",
182       "hexagon-as", TC) {}
183
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:
196     Link(const ToolChain &TC) : Tool("hexagon::Link",
197       "hexagon-ld", TC) {}
198
199     bool hasIntegratedCPP() const override { return false; }
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);
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
234     const toolchains::MachO &getMachOToolChain() const {
235       return reinterpret_cast<const toolchains::MachO&>(getToolChain());
236     }
237
238   public:
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:
245     Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
246                                               "assembler", TC) {}
247
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:
263     Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC) {}
264
265     bool hasIntegratedCPP() const override { return false; }
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:
276     Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
277
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:
288     Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
289                                               "dsymutil", TC) {}
290
291     bool hasIntegratedCPP() const override { return false; }
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:
303     VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
304                                                  "dwarfdump", TC) {}
305
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:
320     Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler",
321                                          TC) {}
322
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:
333     Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {}
334
335     bool hasIntegratedCPP() const override { return false; }
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:
349     Assemble(const ToolChain &TC) : Tool("bitrig::Assemble", "assembler",
350                                          TC) {}
351
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:
361     Link(const ToolChain &TC) : Tool("bitrig::Link", "linker", TC) {}
362
363     bool hasIntegratedCPP() const override { return false; }
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:
377     Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler",
378                                          TC) {}
379
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:
389     Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {}
390
391     bool hasIntegratedCPP() const override { return false; }
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:
406     Assemble(const ToolChain &TC)
407       : Tool("netbsd::Assemble", "assembler", TC) {}
408
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:
419     Link(const ToolChain &TC)
420       : Tool("netbsd::Link", "linker", TC) {}
421
422     bool hasIntegratedCPP() const override { return false; }
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:
436     Assemble(const ToolChain &TC) : Tool("GNU::Assemble", "assembler", TC) {}
437
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:
448     Link(const ToolChain &TC) : Tool("GNU::Link", "linker", TC) {}
449
450     bool hasIntegratedCPP() const override { return false; }
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
461 namespace cygwin {
462 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
463 public:
464   Link(const ToolChain &TC) : Tool("cygwin::Link", "linker", TC) {}
465
466   bool hasIntegratedCPP() const override { return false; }
467   bool isLinkJob() const override { return true; }
468
469   void ConstructJob(Compilation &C, const JobAction &JA,
470                     const InputInfo &Output, const InputInfoList &Inputs,
471                     const llvm::opt::ArgList &Args,
472                     const char *LinkingOutput) const override;
473 private:
474   void AddLibGCC(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const;
475 };
476 }
477
478   /// minix -- Directly call GNU Binutils assembler and linker
479 namespace minix {
480   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
481   public:
482     Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler",
483                                          TC) {}
484
485     bool hasIntegratedCPP() const override { return false; }
486
487     void ConstructJob(Compilation &C, const JobAction &JA,
488                       const InputInfo &Output,
489                       const InputInfoList &Inputs,
490                       const llvm::opt::ArgList &TCArgs,
491                       const char *LinkingOutput) const override;
492   };
493   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
494   public:
495     Link(const ToolChain &TC) : Tool("minix::Link", "linker", TC) {}
496
497     bool hasIntegratedCPP() const override { return false; }
498     bool isLinkJob() const override { return true; }
499
500     void ConstructJob(Compilation &C, const JobAction &JA,
501                       const InputInfo &Output,
502                       const InputInfoList &Inputs,
503                       const llvm::opt::ArgList &TCArgs,
504                       const char *LinkingOutput) const override;
505   };
506 } // end namespace minix
507
508   /// solaris -- Directly call Solaris assembler and linker
509 namespace solaris {
510   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
511   public:
512     Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
513                                          TC) {}
514
515     bool hasIntegratedCPP() const override { return false; }
516
517     void ConstructJob(Compilation &C, const JobAction &JA,
518                       const InputInfo &Output, const InputInfoList &Inputs,
519                       const llvm::opt::ArgList &TCArgs,
520                       const char *LinkingOutput) const override;
521   };
522   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
523   public:
524     Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {}
525
526     bool hasIntegratedCPP() const override { return false; }
527     bool isLinkJob() const override { return true; }
528
529     void ConstructJob(Compilation &C, const JobAction &JA,
530                       const InputInfo &Output, const InputInfoList &Inputs,
531                       const llvm::opt::ArgList &TCArgs,
532                       const char *LinkingOutput) const override;
533   };
534 } // end namespace solaris
535
536   /// auroraux -- Directly call GNU Binutils assembler and linker
537 namespace auroraux {
538   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
539   public:
540     Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler",
541                                          TC) {}
542
543     bool hasIntegratedCPP() const override { return false; }
544
545     void ConstructJob(Compilation &C, const JobAction &JA,
546                       const InputInfo &Output, const InputInfoList &Inputs,
547                       const llvm::opt::ArgList &TCArgs,
548                       const char *LinkingOutput) const override;
549   };
550   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
551   public:
552     Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {}
553
554     bool hasIntegratedCPP() const override { return false; }
555     bool isLinkJob() const override { return true; }
556
557     void ConstructJob(Compilation &C, const JobAction &JA,
558                       const InputInfo &Output, const InputInfoList &Inputs,
559                       const llvm::opt::ArgList &TCArgs,
560                       const char *LinkingOutput) const override;
561   };
562 } // end namespace auroraux
563
564   /// dragonfly -- Directly call GNU Binutils assembler and linker
565 namespace dragonfly {
566   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
567   public:
568     Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler",
569                                          TC) {}
570
571     bool hasIntegratedCPP() const override { return false; }
572
573     void ConstructJob(Compilation &C, const JobAction &JA,
574                       const InputInfo &Output, const InputInfoList &Inputs,
575                       const llvm::opt::ArgList &TCArgs,
576                       const char *LinkingOutput) const override;
577   };
578   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
579   public:
580     Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {}
581
582     bool hasIntegratedCPP() const override { return false; }
583     bool isLinkJob() const override { return true; }
584
585     void ConstructJob(Compilation &C, const JobAction &JA,
586                       const InputInfo &Output,
587                       const InputInfoList &Inputs,
588                       const llvm::opt::ArgList &TCArgs,
589                       const char *LinkingOutput) const override;
590   };
591 } // end namespace dragonfly
592
593 /// Visual studio tools.
594 namespace visualstudio {
595   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
596   public:
597     Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC) {}
598
599     bool hasIntegratedCPP() const override { return false; }
600     bool isLinkJob() const override { return true; }
601
602     void ConstructJob(Compilation &C, const JobAction &JA,
603                       const InputInfo &Output, const InputInfoList &Inputs,
604                       const llvm::opt::ArgList &TCArgs,
605                       const char *LinkingOutput) const override;
606   };
607
608   class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
609   public:
610     Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC) {}
611
612     bool hasIntegratedAssembler() const override { return true; }
613     bool hasIntegratedCPP() const override { return true; }
614     bool isLinkJob() const override { return false; }
615
616     void ConstructJob(Compilation &C, const JobAction &JA,
617                       const InputInfo &Output, const InputInfoList &Inputs,
618                       const llvm::opt::ArgList &TCArgs,
619                       const char *LinkingOutput) const override;
620
621     Command *GetCommand(Compilation &C, const JobAction &JA,
622                         const InputInfo &Output,
623                         const InputInfoList &Inputs,
624                         const llvm::opt::ArgList &TCArgs,
625                         const char *LinkingOutput) const;
626   };
627 } // end namespace visualstudio
628
629 namespace arm {
630   StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
631                          const llvm::Triple &Triple);
632 }
633 namespace XCore {
634   // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
635   // We simply use "clang -cc1" for those actions.
636   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
637   public:
638     Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
639       "XCore-as", TC) {}
640
641     bool hasIntegratedCPP() const override { return false; }
642     void ConstructJob(Compilation &C, const JobAction &JA,
643                       const InputInfo &Output, const InputInfoList &Inputs,
644                       const llvm::opt::ArgList &TCArgs,
645                       const char *LinkingOutput) const override;
646   };
647
648   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
649   public:
650     Link(const ToolChain &TC) : Tool("XCore::Link",
651       "XCore-ld", TC) {}
652
653     bool hasIntegratedCPP() const override { return false; }
654     bool isLinkJob() const override { return true; }
655     void ConstructJob(Compilation &C, const JobAction &JA,
656                       const InputInfo &Output, const InputInfoList &Inputs,
657                       const llvm::opt::ArgList &TCArgs,
658                       const char *LinkingOutput) const override;
659   };
660 } // end namespace XCore.
661
662
663 } // end namespace toolchains
664 } // end namespace driver
665 } // end namespace clang
666
667 #endif // CLANG_LIB_DRIVER_TOOLS_H_