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