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