]> granicus.if.org Git - clang/blob - lib/Driver/Tools.h
Teach Clang how to use response files when calling other tools
[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 LLVM_CLANG_LIB_DRIVER_TOOLS_H
11 #define LLVM_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, RF_Full) {}
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                                         RF_Full) {}
111
112     bool hasGoodDiagnostics() const override { return true; }
113     bool hasIntegratedAssembler() const override { return false; }
114     bool hasIntegratedCPP() const override { return false; }
115
116     void ConstructJob(Compilation &C, const JobAction &JA,
117                       const InputInfo &Output, const InputInfoList &Inputs,
118                       const llvm::opt::ArgList &TCArgs,
119                       const char *LinkingOutput) const override;
120   };
121
122   /// \brief Base class for all GNU tools that provide the same behavior when
123   /// it comes to response files support
124   class GnuTool : public Tool {
125     virtual void anchor();
126
127   public:
128     GnuTool(const char *Name, const char *ShortName, const ToolChain &TC)
129         : Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {}
130   };
131
132   /// gcc - Generic GCC tool implementations.
133 namespace gcc {
134   class LLVM_LIBRARY_VISIBILITY Common : public GnuTool {
135   public:
136     Common(const char *Name, const char *ShortName,
137            const ToolChain &TC) : GnuTool(Name, ShortName, TC) {}
138
139     void ConstructJob(Compilation &C, const JobAction &JA,
140                       const InputInfo &Output,
141                       const InputInfoList &Inputs,
142                       const llvm::opt::ArgList &TCArgs,
143                       const char *LinkingOutput) const override;
144
145     /// RenderExtraToolArgs - Render any arguments necessary to force
146     /// the particular tool mode.
147     virtual void
148         RenderExtraToolArgs(const JobAction &JA,
149                             llvm::opt::ArgStringList &CmdArgs) const = 0;
150   };
151
152   class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
153   public:
154     Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
155                                              "gcc preprocessor", TC) {}
156
157     bool hasGoodDiagnostics() const override { return true; }
158     bool hasIntegratedCPP() const override { return false; }
159
160     void RenderExtraToolArgs(const JobAction &JA,
161                              llvm::opt::ArgStringList &CmdArgs) const override;
162   };
163
164   class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
165   public:
166     Compile(const ToolChain &TC) : Common("gcc::Compile",
167                                           "gcc frontend", TC) {}
168
169     bool hasGoodDiagnostics() const override { return true; }
170     bool hasIntegratedCPP() const override { return true; }
171
172     void RenderExtraToolArgs(const JobAction &JA,
173                              llvm::opt::ArgStringList &CmdArgs) const override;
174   };
175
176   class LLVM_LIBRARY_VISIBILITY Link : public Common  {
177   public:
178     Link(const ToolChain &TC) : Common("gcc::Link",
179                                        "linker (via gcc)", TC) {}
180
181     bool hasIntegratedCPP() const override { return false; }
182     bool isLinkJob() const override { return true; }
183
184     void RenderExtraToolArgs(const JobAction &JA,
185                              llvm::opt::ArgStringList &CmdArgs) const override;
186   };
187 } // end namespace gcc
188
189 namespace hexagon {
190   // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
191   // We simply use "clang -cc1" for those actions.
192   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool {
193   public:
194     Assemble(const ToolChain &TC) : GnuTool("hexagon::Assemble",
195       "hexagon-as", TC) {}
196
197     bool hasIntegratedCPP() const override { return false; }
198
199     void RenderExtraToolArgs(const JobAction &JA,
200                              llvm::opt::ArgStringList &CmdArgs) const;
201     void ConstructJob(Compilation &C, const JobAction &JA,
202                       const InputInfo &Output, const InputInfoList &Inputs,
203                       const llvm::opt::ArgList &TCArgs,
204                       const char *LinkingOutput) const override;
205   };
206
207   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool {
208   public:
209     Link(const ToolChain &TC) : GnuTool("hexagon::Link",
210       "hexagon-ld", TC) {}
211
212     bool hasIntegratedCPP() const override { return false; }
213     bool isLinkJob() const override { return true; }
214
215     virtual void RenderExtraToolArgs(const JobAction &JA,
216                                      llvm::opt::ArgStringList &CmdArgs) const;
217     void ConstructJob(Compilation &C, const JobAction &JA,
218                       const InputInfo &Output, const InputInfoList &Inputs,
219                       const llvm::opt::ArgList &TCArgs,
220                       const char *LinkingOutput) const override;
221   };
222 } // end namespace hexagon.
223
224 namespace arm {
225   StringRef getARMTargetCPU(const llvm::opt::ArgList &Args,
226                             const llvm::Triple &Triple);
227   const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
228                                 const llvm::Triple &Triple);
229   const char* getLLVMArchSuffixForARM(StringRef CPU);
230 }
231
232 namespace mips {
233   void getMipsCPUAndABI(const llvm::opt::ArgList &Args,
234                         const llvm::Triple &Triple, StringRef &CPUName,
235                         StringRef &ABIName);
236   bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
237   bool isUCLibc(const llvm::opt::ArgList &Args);
238   bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
239   bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName,
240                      StringRef ABIName);
241 }
242
243 namespace ppc {
244   bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value);
245 }
246
247 namespace darwin {
248   llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
249   void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
250
251   class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
252     virtual void anchor();
253   protected:
254     void AddMachOArch(const llvm::opt::ArgList &Args,
255                        llvm::opt::ArgStringList &CmdArgs) const;
256
257     const toolchains::MachO &getMachOToolChain() const {
258       return reinterpret_cast<const toolchains::MachO&>(getToolChain());
259     }
260
261   public:
262   MachOTool(
263       const char *Name, const char *ShortName, const ToolChain &TC,
264       ResponseFileSupport ResponseSupport = RF_None,
265       llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8,
266       const char *ResponseFlag = "@")
267       : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding,
268              ResponseFlag) {}
269   };
270
271   class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool  {
272   public:
273     Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
274                                               "assembler", TC) {}
275
276     bool hasIntegratedCPP() const override { return false; }
277
278     void ConstructJob(Compilation &C, const JobAction &JA,
279                       const InputInfo &Output, const InputInfoList &Inputs,
280                       const llvm::opt::ArgList &TCArgs,
281                       const char *LinkingOutput) const override;
282   };
283
284   class LLVM_LIBRARY_VISIBILITY Link : public MachOTool  {
285     bool NeedsTempPath(const InputInfoList &Inputs) const;
286     void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
287                      llvm::opt::ArgStringList &CmdArgs,
288                      const InputInfoList &Inputs) const;
289
290   public:
291     Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC,
292                                           RF_FileList, llvm::sys::WEM_UTF8,
293                                           "-filelist") {}
294
295     bool hasIntegratedCPP() const override { return false; }
296     bool isLinkJob() const override { return true; }
297
298     void ConstructJob(Compilation &C, const JobAction &JA,
299                       const InputInfo &Output, const InputInfoList &Inputs,
300                       const llvm::opt::ArgList &TCArgs,
301                       const char *LinkingOutput) const override;
302   };
303
304   class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool  {
305   public:
306     Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
307
308     bool hasIntegratedCPP() const override { return false; }
309
310     void ConstructJob(Compilation &C, const JobAction &JA,
311                       const InputInfo &Output, const InputInfoList &Inputs,
312                       const llvm::opt::ArgList &TCArgs,
313                       const char *LinkingOutput) const override;
314   };
315
316   class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool  {
317   public:
318     Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
319                                               "dsymutil", TC) {}
320
321     bool hasIntegratedCPP() const override { return false; }
322     bool isDsymutilJob() const override { return true; }
323
324     void ConstructJob(Compilation &C, const JobAction &JA,
325                       const InputInfo &Output,
326                       const InputInfoList &Inputs,
327                       const llvm::opt::ArgList &TCArgs,
328                       const char *LinkingOutput) const override;
329   };
330
331   class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool  {
332   public:
333     VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
334                                                  "dwarfdump", TC) {}
335
336     bool hasIntegratedCPP() const override { return false; }
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
344 }
345
346   /// openbsd -- Directly call GNU Binutils assembler and linker
347 namespace openbsd {
348   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
349   public:
350     Assemble(const ToolChain &TC) : GnuTool("openbsd::Assemble", "assembler",
351                                          TC) {}
352
353     bool hasIntegratedCPP() const override { return false; }
354
355     void ConstructJob(Compilation &C, const JobAction &JA,
356                       const InputInfo &Output,
357                       const InputInfoList &Inputs,
358                       const llvm::opt::ArgList &TCArgs,
359                       const char *LinkingOutput) const override;
360   };
361   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
362   public:
363     Link(const ToolChain &TC) : GnuTool("openbsd::Link", "linker", TC) {}
364
365     bool hasIntegratedCPP() const override { return false; }
366     bool isLinkJob() const override { return true; }
367
368     void ConstructJob(Compilation &C, const JobAction &JA,
369                       const InputInfo &Output, const InputInfoList &Inputs,
370                       const llvm::opt::ArgList &TCArgs,
371                       const char *LinkingOutput) const override;
372   };
373 } // end namespace openbsd
374
375   /// bitrig -- Directly call GNU Binutils assembler and linker
376 namespace bitrig {
377   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
378   public:
379     Assemble(const ToolChain &TC) : GnuTool("bitrig::Assemble", "assembler",
380                                          TC) {}
381
382     bool hasIntegratedCPP() const override { return false; }
383
384     void ConstructJob(Compilation &C, const JobAction &JA,
385                       const InputInfo &Output, const InputInfoList &Inputs,
386                       const llvm::opt::ArgList &TCArgs,
387                       const char *LinkingOutput) const override;
388   };
389   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
390   public:
391     Link(const ToolChain &TC) : GnuTool("bitrig::Link", "linker", TC) {}
392
393     bool hasIntegratedCPP() const override { return false; }
394     bool isLinkJob() const override { return true; }
395
396     void ConstructJob(Compilation &C, const JobAction &JA,
397                       const InputInfo &Output, const InputInfoList &Inputs,
398                       const llvm::opt::ArgList &TCArgs,
399                       const char *LinkingOutput) const override;
400   };
401 } // end namespace bitrig
402
403   /// freebsd -- Directly call GNU Binutils assembler and linker
404 namespace freebsd {
405   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
406   public:
407     Assemble(const ToolChain &TC) : GnuTool("freebsd::Assemble", "assembler",
408                                          TC) {}
409
410     bool hasIntegratedCPP() const override { return false; }
411
412     void ConstructJob(Compilation &C, const JobAction &JA,
413                       const InputInfo &Output, const InputInfoList &Inputs,
414                       const llvm::opt::ArgList &TCArgs,
415                       const char *LinkingOutput) const override;
416   };
417   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
418   public:
419     Link(const ToolChain &TC) : GnuTool("freebsd::Link", "linker", TC) {}
420
421     bool hasIntegratedCPP() const override { return false; }
422     bool isLinkJob() const override { return true; }
423
424     void ConstructJob(Compilation &C, const JobAction &JA,
425                       const InputInfo &Output, const InputInfoList &Inputs,
426                       const llvm::opt::ArgList &TCArgs,
427                       const char *LinkingOutput) const override;
428   };
429 } // end namespace freebsd
430
431   /// netbsd -- Directly call GNU Binutils assembler and linker
432 namespace netbsd {
433   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
434
435   public:
436     Assemble(const ToolChain &TC)
437       : GnuTool("netbsd::Assemble", "assembler", TC) {}
438
439     bool hasIntegratedCPP() const override { return false; }
440
441     void ConstructJob(Compilation &C, const JobAction &JA,
442                       const InputInfo &Output, const InputInfoList &Inputs,
443                       const llvm::opt::ArgList &TCArgs,
444                       const char *LinkingOutput) const override;
445   };
446   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
447
448   public:
449     Link(const ToolChain &TC)
450       : GnuTool("netbsd::Link", "linker", TC) {}
451
452     bool hasIntegratedCPP() const override { return false; }
453     bool isLinkJob() const override { return true; }
454
455     void ConstructJob(Compilation &C, const JobAction &JA,
456                       const InputInfo &Output, const InputInfoList &Inputs,
457                       const llvm::opt::ArgList &TCArgs,
458                       const char *LinkingOutput) const override;
459   };
460 } // end namespace netbsd
461
462   /// Directly call GNU Binutils' assembler and linker.
463 namespace gnutools {
464   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
465   public:
466     Assemble(const ToolChain &TC) : GnuTool("GNU::Assemble", "assembler", TC) {}
467
468     bool hasIntegratedCPP() const override { return false; }
469
470     void ConstructJob(Compilation &C, const JobAction &JA,
471                       const InputInfo &Output,
472                       const InputInfoList &Inputs,
473                       const llvm::opt::ArgList &TCArgs,
474                       const char *LinkingOutput) const override;
475   };
476   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
477   public:
478     Link(const ToolChain &TC) : GnuTool("GNU::Link", "linker", TC) {}
479
480     bool hasIntegratedCPP() const override { return false; }
481     bool isLinkJob() const override { return true; }
482
483     void ConstructJob(Compilation &C, const JobAction &JA,
484                       const InputInfo &Output,
485                       const InputInfoList &Inputs,
486                       const llvm::opt::ArgList &TCArgs,
487                       const char *LinkingOutput) const override;
488   };
489 }
490   /// minix -- Directly call GNU Binutils assembler and linker
491 namespace minix {
492   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
493   public:
494     Assemble(const ToolChain &TC) : GnuTool("minix::Assemble", "assembler",
495                                          TC) {}
496
497     bool hasIntegratedCPP() const override { return false; }
498
499     void ConstructJob(Compilation &C, const JobAction &JA,
500                       const InputInfo &Output,
501                       const InputInfoList &Inputs,
502                       const llvm::opt::ArgList &TCArgs,
503                       const char *LinkingOutput) const override;
504   };
505   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
506   public:
507     Link(const ToolChain &TC) : GnuTool("minix::Link", "linker", TC) {}
508
509     bool hasIntegratedCPP() const override { return false; }
510     bool isLinkJob() const override { return true; }
511
512     void ConstructJob(Compilation &C, const JobAction &JA,
513                       const InputInfo &Output,
514                       const InputInfoList &Inputs,
515                       const llvm::opt::ArgList &TCArgs,
516                       const char *LinkingOutput) const override;
517   };
518 } // end namespace minix
519
520   /// solaris -- Directly call Solaris assembler and linker
521 namespace solaris {
522   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
523   public:
524     Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
525                                          TC) {}
526
527     bool hasIntegratedCPP() const override { return false; }
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   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
535   public:
536     Link(const ToolChain &TC) : Tool("solaris::Link", "linker", TC) {}
537
538     bool hasIntegratedCPP() const override { return false; }
539     bool isLinkJob() const override { return true; }
540
541     void ConstructJob(Compilation &C, const JobAction &JA,
542                       const InputInfo &Output, const InputInfoList &Inputs,
543                       const llvm::opt::ArgList &TCArgs,
544                       const char *LinkingOutput) const override;
545   };
546 } // end namespace solaris
547
548   /// dragonfly -- Directly call GNU Binutils assembler and linker
549 namespace dragonfly {
550   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
551   public:
552     Assemble(const ToolChain &TC) : GnuTool("dragonfly::Assemble", "assembler",
553                                          TC) {}
554
555     bool hasIntegratedCPP() const override { return false; }
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   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
563   public:
564     Link(const ToolChain &TC) : GnuTool("dragonfly::Link", "linker", TC) {}
565
566     bool hasIntegratedCPP() const override { return false; }
567     bool isLinkJob() const override { return true; }
568
569     void ConstructJob(Compilation &C, const JobAction &JA,
570                       const InputInfo &Output,
571                       const InputInfoList &Inputs,
572                       const llvm::opt::ArgList &TCArgs,
573                       const char *LinkingOutput) const override;
574   };
575 } // end namespace dragonfly
576
577 /// Visual studio tools.
578 namespace visualstudio {
579   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
580   public:
581     Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC,
582                                      RF_Full, llvm::sys::WEM_UTF16) {}
583
584     bool hasIntegratedCPP() const override { return false; }
585     bool isLinkJob() const override { return true; }
586
587     void ConstructJob(Compilation &C, const JobAction &JA,
588                       const InputInfo &Output, const InputInfoList &Inputs,
589                       const llvm::opt::ArgList &TCArgs,
590                       const char *LinkingOutput) const override;
591   };
592
593   class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
594   public:
595     Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC,
596                                         RF_Full, llvm::sys::WEM_UTF16) {}
597
598     bool hasIntegratedAssembler() const override { return true; }
599     bool hasIntegratedCPP() const override { return true; }
600     bool isLinkJob() const override { return false; }
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     std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA,
608                                         const InputInfo &Output,
609                                         const InputInfoList &Inputs,
610                                         const llvm::opt::ArgList &TCArgs,
611                                         const char *LinkingOutput) const;
612   };
613 } // end namespace visualstudio
614
615 namespace arm {
616   StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
617                          const llvm::Triple &Triple);
618 }
619 namespace XCore {
620   // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
621   // We simply use "clang -cc1" for those actions.
622   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
623   public:
624     Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
625       "XCore-as", TC) {}
626
627     bool hasIntegratedCPP() const override { return false; }
628     void ConstructJob(Compilation &C, const JobAction &JA,
629                       const InputInfo &Output, const InputInfoList &Inputs,
630                       const llvm::opt::ArgList &TCArgs,
631                       const char *LinkingOutput) const override;
632   };
633
634   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
635   public:
636     Link(const ToolChain &TC) : Tool("XCore::Link",
637       "XCore-ld", TC) {}
638
639     bool hasIntegratedCPP() const override { return false; }
640     bool isLinkJob() const override { return true; }
641     void ConstructJob(Compilation &C, const JobAction &JA,
642                       const InputInfo &Output, const InputInfoList &Inputs,
643                       const llvm::opt::ArgList &TCArgs,
644                       const char *LinkingOutput) const override;
645   };
646 } // end namespace XCore.
647
648
649 } // end namespace toolchains
650 } // end namespace driver
651 } // end namespace clang
652
653 #endif