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