]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Driver/Tools.h
Update Makefiles and other build glue for llvm/clang 3.7.0, as of trunk
[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/Basic/VersionTuple.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/Types.h"
16 #include "clang/Driver/Util.h"
17 #include "llvm/ADT/Triple.h"
18 #include "llvm/Option/Option.h"
19 #include "llvm/Support/Compiler.h"
20
21 namespace clang {
22   class ObjCRuntime;
23
24 namespace driver {
25   class Command;
26   class Driver;
27
28 namespace toolchains {
29   class MachO;
30 }
31
32 namespace tools {
33
34 namespace visualstudio {
35   class Compile;
36 }
37
38 using llvm::opt::ArgStringList;
39
40   /// \brief Clang compiler tool.
41   class LLVM_LIBRARY_VISIBILITY Clang : public Tool {
42   public:
43     static const char *getBaseInputName(const llvm::opt::ArgList &Args,
44                                         const InputInfo &Input);
45     static const char *getBaseInputStem(const llvm::opt::ArgList &Args,
46                                         const InputInfoList &Inputs);
47     static const char *getDependencyFileName(const llvm::opt::ArgList &Args,
48                                              const InputInfoList &Inputs);
49
50   private:
51     void AddPreprocessingOptions(Compilation &C, const JobAction &JA,
52                                  const Driver &D,
53                                  const llvm::opt::ArgList &Args,
54                                  llvm::opt::ArgStringList &CmdArgs,
55                                  const InputInfo &Output,
56                                  const InputInfoList &Inputs) const;
57
58     void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
59                               llvm::opt::ArgStringList &CmdArgs) const;
60     void AddARMTargetArgs(const llvm::opt::ArgList &Args,
61                           llvm::opt::ArgStringList &CmdArgs,
62                           bool KernelOrKext) const;
63     void AddARM64TargetArgs(const llvm::opt::ArgList &Args,
64                             llvm::opt::ArgStringList &CmdArgs) const;
65     void AddMIPSTargetArgs(const llvm::opt::ArgList &Args,
66                            llvm::opt::ArgStringList &CmdArgs) const;
67     void AddPPCTargetArgs(const llvm::opt::ArgList &Args,
68                           llvm::opt::ArgStringList &CmdArgs) const;
69     void AddR600TargetArgs(const llvm::opt::ArgList &Args,
70                            llvm::opt::ArgStringList &CmdArgs) const;
71     void AddSparcTargetArgs(const llvm::opt::ArgList &Args,
72                             llvm::opt::ArgStringList &CmdArgs) const;
73     void AddSystemZTargetArgs(const llvm::opt::ArgList &Args,
74                               llvm::opt::ArgStringList &CmdArgs) const;
75     void AddX86TargetArgs(const llvm::opt::ArgList &Args,
76                           llvm::opt::ArgStringList &CmdArgs) const;
77     void AddHexagonTargetArgs(const llvm::opt::ArgList &Args,
78                               llvm::opt::ArgStringList &CmdArgs) const;
79
80     enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile };
81
82     ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args,
83                                    llvm::opt::ArgStringList &cmdArgs,
84                                    RewriteKind rewrite) const;
85
86     void AddClangCLArgs(const llvm::opt::ArgList &Args,
87                         llvm::opt::ArgStringList &CmdArgs) const;
88
89     visualstudio::Compile *getCLFallback() const;
90
91     mutable std::unique_ptr<visualstudio::Compile> CLFallback;
92
93   public:
94     Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC, RF_Full) {}
95
96     bool hasGoodDiagnostics() const override { return true; }
97     bool hasIntegratedAssembler() const override { return true; }
98     bool hasIntegratedCPP() const override { return true; }
99     bool canEmitIR() const override { return true; }
100
101     void ConstructJob(Compilation &C, const JobAction &JA,
102                       const InputInfo &Output, const InputInfoList &Inputs,
103                       const llvm::opt::ArgList &TCArgs,
104                       const char *LinkingOutput) const override;
105   };
106
107   /// \brief Clang integrated assembler tool.
108   class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
109   public:
110     ClangAs(const ToolChain &TC) : Tool("clang::as",
111                                         "clang integrated assembler", TC,
112                                         RF_Full) {}
113     void AddMIPSTargetArgs(const llvm::opt::ArgList &Args,
114                            llvm::opt::ArgStringList &CmdArgs) const;
115     bool hasGoodDiagnostics() const override { return true; }
116     bool hasIntegratedAssembler() const override { return false; }
117     bool hasIntegratedCPP() const override { return false; }
118
119     void ConstructJob(Compilation &C, const JobAction &JA,
120                       const InputInfo &Output, const InputInfoList &Inputs,
121                       const llvm::opt::ArgList &TCArgs,
122                       const char *LinkingOutput) const override;
123   };
124
125   /// \brief Base class for all GNU tools that provide the same behavior when
126   /// it comes to response files support
127   class GnuTool : public Tool {
128     virtual void anchor();
129
130   public:
131     GnuTool(const char *Name, const char *ShortName, const ToolChain &TC)
132         : Tool(Name, ShortName, TC, RF_Full, llvm::sys::WEM_CurrentCodePage) {}
133   };
134
135   /// gcc - Generic GCC tool implementations.
136 namespace gcc {
137   class LLVM_LIBRARY_VISIBILITY Common : public GnuTool {
138   public:
139     Common(const char *Name, const char *ShortName,
140            const ToolChain &TC) : GnuTool(Name, ShortName, TC) {}
141
142     void ConstructJob(Compilation &C, const JobAction &JA,
143                       const InputInfo &Output,
144                       const InputInfoList &Inputs,
145                       const llvm::opt::ArgList &TCArgs,
146                       const char *LinkingOutput) const override;
147
148     /// RenderExtraToolArgs - Render any arguments necessary to force
149     /// the particular tool mode.
150     virtual void
151         RenderExtraToolArgs(const JobAction &JA,
152                             llvm::opt::ArgStringList &CmdArgs) const = 0;
153   };
154
155   class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
156   public:
157     Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
158                                              "gcc preprocessor", TC) {}
159
160     bool hasGoodDiagnostics() const override { return true; }
161     bool hasIntegratedCPP() const override { return false; }
162
163     void RenderExtraToolArgs(const JobAction &JA,
164                              llvm::opt::ArgStringList &CmdArgs) const override;
165   };
166
167   class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
168   public:
169     Compile(const ToolChain &TC) : Common("gcc::Compile",
170                                           "gcc frontend", TC) {}
171
172     bool hasGoodDiagnostics() const override { return true; }
173     bool hasIntegratedCPP() const override { return true; }
174
175     void RenderExtraToolArgs(const JobAction &JA,
176                              llvm::opt::ArgStringList &CmdArgs) const override;
177   };
178
179   class LLVM_LIBRARY_VISIBILITY Link : public Common  {
180   public:
181     Link(const ToolChain &TC) : Common("gcc::Link",
182                                        "linker (via gcc)", TC) {}
183
184     bool hasIntegratedCPP() const override { return false; }
185     bool isLinkJob() const override { return true; }
186
187     void RenderExtraToolArgs(const JobAction &JA,
188                              llvm::opt::ArgStringList &CmdArgs) const override;
189   };
190 } // end namespace gcc
191
192 namespace hexagon {
193   // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
194   // We simply use "clang -cc1" for those actions.
195   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool {
196   public:
197     Assemble(const ToolChain &TC) : GnuTool("hexagon::Assemble",
198       "hexagon-as", TC) {}
199
200     bool hasIntegratedCPP() const override { return false; }
201
202     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
210   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool {
211   public:
212     Link(const ToolChain &TC) : GnuTool("hexagon::Link",
213       "hexagon-ld", TC) {}
214
215     bool hasIntegratedCPP() const override { return false; }
216     bool isLinkJob() const override { return true; }
217
218     virtual void RenderExtraToolArgs(const JobAction &JA,
219                                      llvm::opt::ArgStringList &CmdArgs) const;
220     void ConstructJob(Compilation &C, const JobAction &JA,
221                       const InputInfo &Output, const InputInfoList &Inputs,
222                       const llvm::opt::ArgList &TCArgs,
223                       const char *LinkingOutput) const override;
224   };
225 } // end namespace hexagon.
226
227 namespace arm {
228   std::string getARMTargetCPU(const llvm::opt::ArgList &Args,
229                               const llvm::Triple &Triple);
230   const StringRef getARMArch(const llvm::opt::ArgList &Args,
231                              const llvm::Triple &Triple);
232   const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
233                                 const llvm::Triple &Triple);
234   const char* getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch);
235
236   void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple);
237 }
238
239 namespace mips {
240   typedef enum {
241     NanLegacy = 1,
242     Nan2008 = 2
243   } NanEncoding;
244   NanEncoding getSupportedNanEncoding(StringRef &CPU);
245   void getMipsCPUAndABI(const llvm::opt::ArgList &Args,
246                         const llvm::Triple &Triple, StringRef &CPUName,
247                         StringRef &ABIName);
248   bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
249   bool isUCLibc(const llvm::opt::ArgList &Args);
250   bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
251   bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName,
252                      StringRef ABIName);
253 }
254
255 namespace ppc {
256   bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value);
257 }
258
259   /// cloudabi -- Directly call GNU Binutils linker
260 namespace cloudabi {
261 class LLVM_LIBRARY_VISIBILITY Link : public GnuTool {
262 public:
263   Link(const ToolChain &TC) : GnuTool("cloudabi::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 } // end namespace cloudabi
274
275 namespace darwin {
276   llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
277   void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
278
279   class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
280     virtual void anchor();
281   protected:
282     void AddMachOArch(const llvm::opt::ArgList &Args,
283                        llvm::opt::ArgStringList &CmdArgs) const;
284
285     const toolchains::MachO &getMachOToolChain() const {
286       return reinterpret_cast<const toolchains::MachO&>(getToolChain());
287     }
288
289   public:
290   MachOTool(
291       const char *Name, const char *ShortName, const ToolChain &TC,
292       ResponseFileSupport ResponseSupport = RF_None,
293       llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8,
294       const char *ResponseFlag = "@")
295       : Tool(Name, ShortName, TC, ResponseSupport, ResponseEncoding,
296              ResponseFlag) {}
297   };
298
299   class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool  {
300   public:
301     Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
302                                               "assembler", TC) {}
303
304     bool hasIntegratedCPP() const override { return false; }
305
306     void ConstructJob(Compilation &C, const JobAction &JA,
307                       const InputInfo &Output, const InputInfoList &Inputs,
308                       const llvm::opt::ArgList &TCArgs,
309                       const char *LinkingOutput) const override;
310   };
311
312   class LLVM_LIBRARY_VISIBILITY Link : public MachOTool  {
313     bool NeedsTempPath(const InputInfoList &Inputs) const;
314     void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
315                      llvm::opt::ArgStringList &CmdArgs,
316                      const InputInfoList &Inputs) const;
317
318   public:
319     Link(const ToolChain &TC) : MachOTool("darwin::Link", "linker", TC,
320                                           RF_FileList, llvm::sys::WEM_UTF8,
321                                           "-filelist") {}
322
323     bool hasIntegratedCPP() const override { return false; }
324     bool isLinkJob() const override { return true; }
325
326     void ConstructJob(Compilation &C, const JobAction &JA,
327                       const InputInfo &Output, const InputInfoList &Inputs,
328                       const llvm::opt::ArgList &TCArgs,
329                       const char *LinkingOutput) const override;
330   };
331
332   class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool  {
333   public:
334     Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", 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   class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool  {
345   public:
346     Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
347                                               "dsymutil", TC) {}
348
349     bool hasIntegratedCPP() const override { return false; }
350     bool isDsymutilJob() const override { return true; }
351
352     void ConstructJob(Compilation &C, const JobAction &JA,
353                       const InputInfo &Output,
354                       const InputInfoList &Inputs,
355                       const llvm::opt::ArgList &TCArgs,
356                       const char *LinkingOutput) const override;
357   };
358
359   class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool  {
360   public:
361     VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
362                                                  "dwarfdump", 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
372 }
373
374   /// openbsd -- Directly call GNU Binutils assembler and linker
375 namespace openbsd {
376   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
377   public:
378     Assemble(const ToolChain &TC) : GnuTool("openbsd::Assemble", "assembler",
379                                          TC) {}
380
381     bool hasIntegratedCPP() const override { return false; }
382
383     void ConstructJob(Compilation &C, const JobAction &JA,
384                       const InputInfo &Output,
385                       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("openbsd::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 openbsd
402
403   /// bitrig -- Directly call GNU Binutils assembler and linker
404 namespace bitrig {
405   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
406   public:
407     Assemble(const ToolChain &TC) : GnuTool("bitrig::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("bitrig::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 bitrig
430
431   /// freebsd -- Directly call GNU Binutils assembler and linker
432 namespace freebsd {
433   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
434   public:
435     Assemble(const ToolChain &TC) : GnuTool("freebsd::Assemble", "assembler",
436                                          TC) {}
437
438     bool hasIntegratedCPP() const override { return false; }
439
440     void ConstructJob(Compilation &C, const JobAction &JA,
441                       const InputInfo &Output, const InputInfoList &Inputs,
442                       const llvm::opt::ArgList &TCArgs,
443                       const char *LinkingOutput) const override;
444   };
445   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
446   public:
447     Link(const ToolChain &TC) : GnuTool("freebsd::Link", "linker", TC) {}
448
449     bool hasIntegratedCPP() const override { return false; }
450     bool isLinkJob() const override { return true; }
451
452     void ConstructJob(Compilation &C, const JobAction &JA,
453                       const InputInfo &Output, const InputInfoList &Inputs,
454                       const llvm::opt::ArgList &TCArgs,
455                       const char *LinkingOutput) const override;
456   };
457 } // end namespace freebsd
458
459   /// netbsd -- Directly call GNU Binutils assembler and linker
460 namespace netbsd {
461   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
462
463   public:
464     Assemble(const ToolChain &TC)
465       : GnuTool("netbsd::Assemble", "assembler", TC) {}
466
467     bool hasIntegratedCPP() const override { return false; }
468
469     void ConstructJob(Compilation &C, const JobAction &JA,
470                       const InputInfo &Output, const InputInfoList &Inputs,
471                       const llvm::opt::ArgList &TCArgs,
472                       const char *LinkingOutput) const override;
473   };
474   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
475
476   public:
477     Link(const ToolChain &TC)
478       : GnuTool("netbsd::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, const InputInfoList &Inputs,
485                       const llvm::opt::ArgList &TCArgs,
486                       const char *LinkingOutput) const override;
487   };
488 } // end namespace netbsd
489
490   /// Directly call GNU Binutils' assembler and linker.
491 namespace gnutools {
492   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
493   public:
494     Assemble(const ToolChain &TC) : GnuTool("GNU::Assemble", "assembler", TC) {}
495
496     bool hasIntegratedCPP() const override { return false; }
497
498     void ConstructJob(Compilation &C, const JobAction &JA,
499                       const InputInfo &Output,
500                       const InputInfoList &Inputs,
501                       const llvm::opt::ArgList &TCArgs,
502                       const char *LinkingOutput) const override;
503   };
504   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
505   public:
506     Link(const ToolChain &TC) : GnuTool("GNU::Link", "linker", TC) {}
507
508     bool hasIntegratedCPP() const override { return false; }
509     bool isLinkJob() const override { return true; }
510
511     void ConstructJob(Compilation &C, const JobAction &JA,
512                       const InputInfo &Output,
513                       const InputInfoList &Inputs,
514                       const llvm::opt::ArgList &TCArgs,
515                       const char *LinkingOutput) const override;
516   };
517 }
518
519 namespace nacltools {
520   class LLVM_LIBRARY_VISIBILITY AssembleARM : public gnutools::Assemble  {
521   public:
522     AssembleARM(const ToolChain &TC) : gnutools::Assemble(TC) {}
523
524     void ConstructJob(Compilation &C, const JobAction &JA,
525                       const InputInfo &Output,
526                       const InputInfoList &Inputs,
527                       const llvm::opt::ArgList &TCArgs,
528                       const char *LinkingOutput) const override;
529   };
530   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
531   public:
532     Link(const ToolChain &TC) : Tool("NaCl::Link", "linker", TC) {}
533
534     bool hasIntegratedCPP() const override { return false; }
535     bool isLinkJob() const override { return true; }
536
537     void ConstructJob(Compilation &C, const JobAction &JA,
538                               const InputInfo &Output,
539                               const InputInfoList &Inputs,
540                               const llvm::opt::ArgList &TCArgs,
541                               const char *LinkingOutput) const override;
542   };
543 }
544
545   /// minix -- Directly call GNU Binutils assembler and linker
546 namespace minix {
547   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
548   public:
549     Assemble(const ToolChain &TC) : GnuTool("minix::Assemble", "assembler",
550                                          TC) {}
551
552     bool hasIntegratedCPP() const override { return false; }
553
554     void ConstructJob(Compilation &C, const JobAction &JA,
555                       const InputInfo &Output,
556                       const InputInfoList &Inputs,
557                       const llvm::opt::ArgList &TCArgs,
558                       const char *LinkingOutput) const override;
559   };
560   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
561   public:
562     Link(const ToolChain &TC) : GnuTool("minix::Link", "linker", TC) {}
563
564     bool hasIntegratedCPP() const override { return false; }
565     bool isLinkJob() const override { return true; }
566
567     void ConstructJob(Compilation &C, const JobAction &JA,
568                       const InputInfo &Output,
569                       const InputInfoList &Inputs,
570                       const llvm::opt::ArgList &TCArgs,
571                       const char *LinkingOutput) const override;
572   };
573 } // end namespace minix
574
575   /// solaris -- Directly call Solaris assembler and linker
576 namespace solaris {
577   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
578   public:
579     Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
580                                          TC) {}
581
582     bool hasIntegratedCPP() const override { return false; }
583
584     void ConstructJob(Compilation &C, const JobAction &JA,
585                       const InputInfo &Output, const InputInfoList &Inputs,
586                       const llvm::opt::ArgList &TCArgs,
587                       const char *LinkingOutput) const override;
588   };
589   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
590   public:
591     Link(const ToolChain &TC) : Tool("solaris::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 } // end namespace solaris
602
603   /// dragonfly -- Directly call GNU Binutils assembler and linker
604 namespace dragonfly {
605   class LLVM_LIBRARY_VISIBILITY Assemble : public GnuTool  {
606   public:
607     Assemble(const ToolChain &TC) : GnuTool("dragonfly::Assemble", "assembler",
608                                          TC) {}
609
610     bool hasIntegratedCPP() const override { return false; }
611
612     void ConstructJob(Compilation &C, const JobAction &JA,
613                       const InputInfo &Output, const InputInfoList &Inputs,
614                       const llvm::opt::ArgList &TCArgs,
615                       const char *LinkingOutput) const override;
616   };
617   class LLVM_LIBRARY_VISIBILITY Link : public GnuTool  {
618   public:
619     Link(const ToolChain &TC) : GnuTool("dragonfly::Link", "linker", TC) {}
620
621     bool hasIntegratedCPP() const override { return false; }
622     bool isLinkJob() const override { return true; }
623
624     void ConstructJob(Compilation &C, const JobAction &JA,
625                       const InputInfo &Output,
626                       const InputInfoList &Inputs,
627                       const llvm::opt::ArgList &TCArgs,
628                       const char *LinkingOutput) const override;
629   };
630 } // end namespace dragonfly
631
632 /// Visual studio tools.
633 namespace visualstudio {
634   VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple,
635                               const llvm::opt::ArgList &Args,
636                               bool IsWindowsMSVC);
637
638   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
639   public:
640     Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC,
641                                      RF_Full, llvm::sys::WEM_UTF16) {}
642
643     bool hasIntegratedCPP() const override { return false; }
644     bool isLinkJob() const override { return true; }
645
646     void ConstructJob(Compilation &C, const JobAction &JA,
647                       const InputInfo &Output, const InputInfoList &Inputs,
648                       const llvm::opt::ArgList &TCArgs,
649                       const char *LinkingOutput) const override;
650   };
651
652   class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
653   public:
654     Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC,
655                                         RF_Full, llvm::sys::WEM_UTF16) {}
656
657     bool hasIntegratedAssembler() const override { return true; }
658     bool hasIntegratedCPP() const override { return true; }
659     bool isLinkJob() const override { return false; }
660
661     void ConstructJob(Compilation &C, const JobAction &JA,
662                       const InputInfo &Output, const InputInfoList &Inputs,
663                       const llvm::opt::ArgList &TCArgs,
664                       const char *LinkingOutput) const override;
665
666     std::unique_ptr<Command> GetCommand(Compilation &C, const JobAction &JA,
667                                         const InputInfo &Output,
668                                         const InputInfoList &Inputs,
669                                         const llvm::opt::ArgList &TCArgs,
670                                         const char *LinkingOutput) const;
671   };
672 } // end namespace visualstudio
673
674 namespace arm {
675   StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
676                          const llvm::Triple &Triple);
677 }
678 namespace XCore {
679   // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
680   // We simply use "clang -cc1" for those actions.
681   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
682   public:
683     Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
684       "XCore-as", TC) {}
685
686     bool hasIntegratedCPP() const override { return false; }
687     void ConstructJob(Compilation &C, const JobAction &JA,
688                       const InputInfo &Output, const InputInfoList &Inputs,
689                       const llvm::opt::ArgList &TCArgs,
690                       const char *LinkingOutput) const override;
691   };
692
693   class LLVM_LIBRARY_VISIBILITY Link : public Tool {
694   public:
695     Link(const ToolChain &TC) : Tool("XCore::Link",
696       "XCore-ld", TC) {}
697
698     bool hasIntegratedCPP() const override { return false; }
699     bool isLinkJob() const override { return true; }
700     void ConstructJob(Compilation &C, const JobAction &JA,
701                       const InputInfo &Output, const InputInfoList &Inputs,
702                       const llvm::opt::ArgList &TCArgs,
703                       const char *LinkingOutput) const override;
704   };
705 } // end namespace XCore.
706
707 namespace CrossWindows {
708 class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
709 public:
710   Assemble(const ToolChain &TC) : Tool("CrossWindows::Assemble", "as", TC) { }
711
712   bool hasIntegratedCPP() const override { return false; }
713
714   void ConstructJob(Compilation &C, const JobAction &JA,
715                     const InputInfo &Output, const InputInfoList &Inputs,
716                     const llvm::opt::ArgList &TCArgs,
717                     const char *LinkingOutput) const override;
718 };
719
720 class LLVM_LIBRARY_VISIBILITY Link : public Tool {
721 public:
722   Link(const ToolChain &TC) : Tool("CrossWindows::Link", "ld", TC, RF_Full) {}
723
724   bool hasIntegratedCPP() const override { return false; }
725   bool isLinkJob() const override { return true; }
726
727   void ConstructJob(Compilation &C, const JobAction &JA,
728                     const InputInfo &Output, const InputInfoList &Inputs,
729                     const llvm::opt::ArgList &TCArgs,
730                     const char *LinkingOutput) const override;
731 };
732 }
733
734 } // end namespace tools
735 } // end namespace driver
736 } // end namespace clang
737
738 #endif