1//===--- Tools.h - Tool Implementations -------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef CLANG_LIB_DRIVER_TOOLS_H_
11#define CLANG_LIB_DRIVER_TOOLS_H_
12
13#include "clang/Driver/Tool.h"
14#include "clang/Driver/Types.h"
15#include "clang/Driver/Util.h"
16#include "llvm/ADT/Triple.h"
17#include "llvm/Option/Option.h"
18#include "llvm/Support/Compiler.h"
19
20namespace clang {
21  class ObjCRuntime;
22
23namespace driver {
24  class Command;
25  class Driver;
26
27namespace toolchains {
28  class MachO;
29}
30
31namespace tools {
32
33namespace visualstudio {
34  class Compile;
35}
36
37using 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 AddR600TargetArgs(const llvm::opt::ArgList &Args,
67                           llvm::opt::ArgStringList &CmdArgs) const;
68    void AddSparcTargetArgs(const llvm::opt::ArgList &Args,
69                            llvm::opt::ArgStringList &CmdArgs) const;
70    void AddSystemZTargetArgs(const llvm::opt::ArgList &Args,
71                              llvm::opt::ArgStringList &CmdArgs) const;
72    void AddX86TargetArgs(const llvm::opt::ArgList &Args,
73                          llvm::opt::ArgStringList &CmdArgs) const;
74    void AddHexagonTargetArgs(const llvm::opt::ArgList &Args,
75                              llvm::opt::ArgStringList &CmdArgs) const;
76
77    enum RewriteKind { RK_None, RK_Fragile, RK_NonFragile };
78
79    ObjCRuntime AddObjCRuntimeArgs(const llvm::opt::ArgList &args,
80                                   llvm::opt::ArgStringList &cmdArgs,
81                                   RewriteKind rewrite) const;
82
83    void AddClangCLArgs(const llvm::opt::ArgList &Args,
84                        llvm::opt::ArgStringList &CmdArgs) const;
85
86    visualstudio::Compile *getCLFallback() const;
87
88    mutable std::unique_ptr<visualstudio::Compile> CLFallback;
89
90  public:
91    Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
92
93    bool hasGoodDiagnostics() const override { return true; }
94    bool hasIntegratedAssembler() const override { return true; }
95    bool hasIntegratedCPP() const override { return true; }
96
97    void ConstructJob(Compilation &C, const JobAction &JA,
98                      const InputInfo &Output, const InputInfoList &Inputs,
99                      const llvm::opt::ArgList &TCArgs,
100                      const char *LinkingOutput) const override;
101  };
102
103  /// \brief Clang integrated assembler tool.
104  class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
105  public:
106    ClangAs(const ToolChain &TC) : Tool("clang::as",
107                                        "clang integrated assembler", TC) {}
108
109    bool hasGoodDiagnostics() const override { return true; }
110    bool hasIntegratedAssembler() const override { return false; }
111    bool hasIntegratedCPP() const override { return false; }
112
113    void ConstructJob(Compilation &C, const JobAction &JA,
114                      const InputInfo &Output, const InputInfoList &Inputs,
115                      const llvm::opt::ArgList &TCArgs,
116                      const char *LinkingOutput) const override;
117  };
118
119  /// gcc - Generic GCC tool implementations.
120namespace gcc {
121  class LLVM_LIBRARY_VISIBILITY Common : public Tool {
122  public:
123    Common(const char *Name, const char *ShortName,
124           const ToolChain &TC) : Tool(Name, ShortName, TC) {}
125
126    void ConstructJob(Compilation &C, const JobAction &JA,
127                      const InputInfo &Output,
128                      const InputInfoList &Inputs,
129                      const llvm::opt::ArgList &TCArgs,
130                      const char *LinkingOutput) const override;
131
132    /// RenderExtraToolArgs - Render any arguments necessary to force
133    /// the particular tool mode.
134    virtual void
135        RenderExtraToolArgs(const JobAction &JA,
136                            llvm::opt::ArgStringList &CmdArgs) const = 0;
137  };
138
139  class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
140  public:
141    Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
142                                             "gcc preprocessor", TC) {}
143
144    bool hasGoodDiagnostics() const override { return true; }
145    bool hasIntegratedCPP() const override { return false; }
146
147    void RenderExtraToolArgs(const JobAction &JA,
148                             llvm::opt::ArgStringList &CmdArgs) const override;
149  };
150
151  class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
152  public:
153    Compile(const ToolChain &TC) : Common("gcc::Compile",
154                                          "gcc frontend", TC) {}
155
156    bool hasGoodDiagnostics() const override { return true; }
157    bool hasIntegratedCPP() const override { return true; }
158
159    void RenderExtraToolArgs(const JobAction &JA,
160                             llvm::opt::ArgStringList &CmdArgs) const override;
161  };
162
163  class LLVM_LIBRARY_VISIBILITY Link : public Common  {
164  public:
165    Link(const ToolChain &TC) : Common("gcc::Link",
166                                       "linker (via gcc)", TC) {}
167
168    bool hasIntegratedCPP() const override { return false; }
169    bool isLinkJob() const override { return true; }
170
171    void RenderExtraToolArgs(const JobAction &JA,
172                             llvm::opt::ArgStringList &CmdArgs) const override;
173  };
174} // end namespace gcc
175
176namespace hexagon {
177  // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
178  // We simply use "clang -cc1" for those actions.
179  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
180  public:
181    Assemble(const ToolChain &TC) : Tool("hexagon::Assemble",
182      "hexagon-as", TC) {}
183
184    bool hasIntegratedCPP() const override { return false; }
185
186    void RenderExtraToolArgs(const JobAction &JA,
187                             llvm::opt::ArgStringList &CmdArgs) const;
188    void ConstructJob(Compilation &C, const JobAction &JA,
189                      const InputInfo &Output, const InputInfoList &Inputs,
190                      const llvm::opt::ArgList &TCArgs,
191                      const char *LinkingOutput) const override;
192  };
193
194  class LLVM_LIBRARY_VISIBILITY Link : public Tool {
195  public:
196    Link(const ToolChain &TC) : Tool("hexagon::Link",
197      "hexagon-ld", TC) {}
198
199    bool hasIntegratedCPP() const override { return false; }
200    bool isLinkJob() const override { return true; }
201
202    virtual 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} // end namespace hexagon.
210
211namespace arm {
212  StringRef getARMTargetCPU(const llvm::opt::ArgList &Args,
213                            const llvm::Triple &Triple);
214  const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
215                                const llvm::Triple &Triple);
216  const char* getLLVMArchSuffixForARM(StringRef CPU);
217}
218
219namespace mips {
220  bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
221  bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
222}
223
224namespace darwin {
225  llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
226  void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
227
228  class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
229    virtual void anchor();
230  protected:
231    void AddMachOArch(const llvm::opt::ArgList &Args,
232                       llvm::opt::ArgStringList &CmdArgs) const;
233
234    const toolchains::MachO &getMachOToolChain() const {
235      return reinterpret_cast<const toolchains::MachO&>(getToolChain());
236    }
237
238  public:
239    MachOTool(const char *Name, const char *ShortName,
240               const ToolChain &TC) : Tool(Name, ShortName, TC) {}
241  };
242
243  class LLVM_LIBRARY_VISIBILITY Assemble : public MachOTool  {
244  public:
245    Assemble(const ToolChain &TC) : MachOTool("darwin::Assemble",
246                                              "assembler", TC) {}
247
248    bool hasIntegratedCPP() const override { return false; }
249
250    void ConstructJob(Compilation &C, const JobAction &JA,
251                      const InputInfo &Output, const InputInfoList &Inputs,
252                      const llvm::opt::ArgList &TCArgs,
253                      const char *LinkingOutput) const override;
254  };
255
256  class LLVM_LIBRARY_VISIBILITY Link : public MachOTool  {
257    bool NeedsTempPath(const InputInfoList &Inputs) const;
258    void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
259                     llvm::opt::ArgStringList &CmdArgs,
260                     const InputInfoList &Inputs) const;
261
262  public:
263    Link(const ToolChain &TC) : MachOTool("darwin::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
274  class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool  {
275  public:
276    Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
277
278    bool hasIntegratedCPP() const override { return false; }
279
280    void ConstructJob(Compilation &C, const JobAction &JA,
281                      const InputInfo &Output, const InputInfoList &Inputs,
282                      const llvm::opt::ArgList &TCArgs,
283                      const char *LinkingOutput) const override;
284  };
285
286  class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool  {
287  public:
288    Dsymutil(const ToolChain &TC) : MachOTool("darwin::Dsymutil",
289                                              "dsymutil", TC) {}
290
291    bool hasIntegratedCPP() const override { return false; }
292    bool isDsymutilJob() const override { return true; }
293
294    void ConstructJob(Compilation &C, const JobAction &JA,
295                      const InputInfo &Output,
296                      const InputInfoList &Inputs,
297                      const llvm::opt::ArgList &TCArgs,
298                      const char *LinkingOutput) const override;
299  };
300
301  class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool  {
302  public:
303    VerifyDebug(const ToolChain &TC) : MachOTool("darwin::VerifyDebug",
304                                                 "dwarfdump", TC) {}
305
306    bool hasIntegratedCPP() const override { return false; }
307
308    void ConstructJob(Compilation &C, const JobAction &JA,
309                      const InputInfo &Output, const InputInfoList &Inputs,
310                      const llvm::opt::ArgList &TCArgs,
311                      const char *LinkingOutput) const override;
312  };
313
314}
315
316  /// openbsd -- Directly call GNU Binutils assembler and linker
317namespace openbsd {
318  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
319  public:
320    Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler",
321                                         TC) {}
322
323    bool hasIntegratedCPP() const override { return false; }
324
325    void ConstructJob(Compilation &C, const JobAction &JA,
326                      const InputInfo &Output,
327                      const InputInfoList &Inputs,
328                      const llvm::opt::ArgList &TCArgs,
329                      const char *LinkingOutput) const override;
330  };
331  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
332  public:
333    Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {}
334
335    bool hasIntegratedCPP() const override { return false; }
336    bool isLinkJob() const override { return true; }
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} // end namespace openbsd
344
345  /// bitrig -- Directly call GNU Binutils assembler and linker
346namespace bitrig {
347  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
348  public:
349    Assemble(const ToolChain &TC) : Tool("bitrig::Assemble", "assembler",
350                                         TC) {}
351
352    bool hasIntegratedCPP() const override { return false; }
353
354    void ConstructJob(Compilation &C, const JobAction &JA,
355                      const InputInfo &Output, const InputInfoList &Inputs,
356                      const llvm::opt::ArgList &TCArgs,
357                      const char *LinkingOutput) const override;
358  };
359  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
360  public:
361    Link(const ToolChain &TC) : Tool("bitrig::Link", "linker", TC) {}
362
363    bool hasIntegratedCPP() const override { return false; }
364    bool isLinkJob() const override { return true; }
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} // end namespace bitrig
372
373  /// freebsd -- Directly call GNU Binutils assembler and linker
374namespace freebsd {
375  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
376  public:
377    Assemble(const ToolChain &TC) : Tool("freebsd::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, const InputInfoList &Inputs,
384                      const llvm::opt::ArgList &TCArgs,
385                      const char *LinkingOutput) const override;
386  };
387  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
388  public:
389    Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {}
390
391    bool hasIntegratedCPP() const override { return false; }
392    bool isLinkJob() const override { return true; }
393
394    void ConstructJob(Compilation &C, const JobAction &JA,
395                      const InputInfo &Output, const InputInfoList &Inputs,
396                      const llvm::opt::ArgList &TCArgs,
397                      const char *LinkingOutput) const override;
398  };
399} // end namespace freebsd
400
401  /// netbsd -- Directly call GNU Binutils assembler and linker
402namespace netbsd {
403  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
404
405  public:
406    Assemble(const ToolChain &TC)
407      : Tool("netbsd::Assemble", "assembler", 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 Tool  {
417
418  public:
419    Link(const ToolChain &TC)
420      : Tool("netbsd::Link", "linker", TC) {}
421
422    bool hasIntegratedCPP() const override { return false; }
423    bool isLinkJob() const override { return true; }
424
425    void ConstructJob(Compilation &C, const JobAction &JA,
426                      const InputInfo &Output, const InputInfoList &Inputs,
427                      const llvm::opt::ArgList &TCArgs,
428                      const char *LinkingOutput) const override;
429  };
430} // end namespace netbsd
431
432  /// Directly call GNU Binutils' assembler and linker.
433namespace gnutools {
434  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
435  public:
436    Assemble(const ToolChain &TC) : Tool("GNU::Assemble", "assembler", TC) {}
437
438    bool hasIntegratedCPP() const override { return false; }
439
440    void ConstructJob(Compilation &C, const JobAction &JA,
441                      const InputInfo &Output,
442                      const InputInfoList &Inputs,
443                      const llvm::opt::ArgList &TCArgs,
444                      const char *LinkingOutput) const override;
445  };
446  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
447  public:
448    Link(const ToolChain &TC) : Tool("GNU::Link", "linker", TC) {}
449
450    bool hasIntegratedCPP() const override { return false; }
451    bool isLinkJob() const override { return true; }
452
453    void ConstructJob(Compilation &C, const JobAction &JA,
454                      const InputInfo &Output,
455                      const InputInfoList &Inputs,
456                      const llvm::opt::ArgList &TCArgs,
457                      const char *LinkingOutput) const override;
458  };
459}
460  /// minix -- Directly call GNU Binutils assembler and linker
461namespace minix {
462  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
463  public:
464    Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler",
465                                         TC) {}
466
467    bool hasIntegratedCPP() const override { return false; }
468
469    void ConstructJob(Compilation &C, const JobAction &JA,
470                      const InputInfo &Output,
471                      const InputInfoList &Inputs,
472                      const llvm::opt::ArgList &TCArgs,
473                      const char *LinkingOutput) const override;
474  };
475  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
476  public:
477    Link(const ToolChain &TC) : Tool("minix::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,
484                      const InputInfoList &Inputs,
485                      const llvm::opt::ArgList &TCArgs,
486                      const char *LinkingOutput) const override;
487  };
488} // end namespace minix
489
490  /// solaris -- Directly call Solaris assembler and linker
491namespace solaris {
492  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
493  public:
494    Assemble(const ToolChain &TC) : Tool("solaris::Assemble", "assembler",
495                                         TC) {}
496
497    bool hasIntegratedCPP() const override { return false; }
498
499    void ConstructJob(Compilation &C, const JobAction &JA,
500                      const InputInfo &Output, const InputInfoList &Inputs,
501                      const llvm::opt::ArgList &TCArgs,
502                      const char *LinkingOutput) const override;
503  };
504  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
505  public:
506    Link(const ToolChain &TC) : Tool("solaris::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, const InputInfoList &Inputs,
513                      const llvm::opt::ArgList &TCArgs,
514                      const char *LinkingOutput) const override;
515  };
516} // end namespace solaris
517
518  /// auroraux -- Directly call GNU Binutils assembler and linker
519namespace auroraux {
520  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
521  public:
522    Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler",
523                                         TC) {}
524
525    bool hasIntegratedCPP() const override { return false; }
526
527    void ConstructJob(Compilation &C, const JobAction &JA,
528                      const InputInfo &Output, const InputInfoList &Inputs,
529                      const llvm::opt::ArgList &TCArgs,
530                      const char *LinkingOutput) const override;
531  };
532  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
533  public:
534    Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {}
535
536    bool hasIntegratedCPP() const override { return false; }
537    bool isLinkJob() const override { return true; }
538
539    void ConstructJob(Compilation &C, const JobAction &JA,
540                      const InputInfo &Output, const InputInfoList &Inputs,
541                      const llvm::opt::ArgList &TCArgs,
542                      const char *LinkingOutput) const override;
543  };
544} // end namespace auroraux
545
546  /// dragonfly -- Directly call GNU Binutils assembler and linker
547namespace dragonfly {
548  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
549  public:
550    Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler",
551                                         TC) {}
552
553    bool hasIntegratedCPP() const override { return false; }
554
555    void ConstructJob(Compilation &C, const JobAction &JA,
556                      const InputInfo &Output, const InputInfoList &Inputs,
557                      const llvm::opt::ArgList &TCArgs,
558                      const char *LinkingOutput) const override;
559  };
560  class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
561  public:
562    Link(const ToolChain &TC) : Tool("dragonfly::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 dragonfly
574
575/// Visual studio tools.
576namespace visualstudio {
577  class LLVM_LIBRARY_VISIBILITY Link : public Tool {
578  public:
579    Link(const ToolChain &TC) : Tool("visualstudio::Link", "linker", TC) {}
580
581    bool hasIntegratedCPP() const override { return false; }
582    bool isLinkJob() const override { return true; }
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
590  class LLVM_LIBRARY_VISIBILITY Compile : public Tool {
591  public:
592    Compile(const ToolChain &TC) : Tool("visualstudio::Compile", "compiler", TC) {}
593
594    bool hasIntegratedAssembler() const override { return true; }
595    bool hasIntegratedCPP() const override { return true; }
596    bool isLinkJob() const override { return false; }
597
598    void ConstructJob(Compilation &C, const JobAction &JA,
599                      const InputInfo &Output, const InputInfoList &Inputs,
600                      const llvm::opt::ArgList &TCArgs,
601                      const char *LinkingOutput) const override;
602
603    Command *GetCommand(Compilation &C, const JobAction &JA,
604                        const InputInfo &Output,
605                        const InputInfoList &Inputs,
606                        const llvm::opt::ArgList &TCArgs,
607                        const char *LinkingOutput) const;
608  };
609} // end namespace visualstudio
610
611namespace arm {
612  StringRef getARMFloatABI(const Driver &D, const llvm::opt::ArgList &Args,
613                         const llvm::Triple &Triple);
614}
615namespace XCore {
616  // For XCore, we do not need to instantiate tools for PreProcess, PreCompile and Compile.
617  // We simply use "clang -cc1" for those actions.
618  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
619  public:
620    Assemble(const ToolChain &TC) : Tool("XCore::Assemble",
621      "XCore-as", TC) {}
622
623    bool hasIntegratedCPP() const override { return false; }
624    void ConstructJob(Compilation &C, const JobAction &JA,
625                      const InputInfo &Output, const InputInfoList &Inputs,
626                      const llvm::opt::ArgList &TCArgs,
627                      const char *LinkingOutput) const override;
628  };
629
630  class LLVM_LIBRARY_VISIBILITY Link : public Tool {
631  public:
632    Link(const ToolChain &TC) : Tool("XCore::Link",
633      "XCore-ld", TC) {}
634
635    bool hasIntegratedCPP() const override { return false; }
636    bool isLinkJob() const override { return true; }
637    void ConstructJob(Compilation &C, const JobAction &JA,
638                      const InputInfo &Output, const InputInfoList &Inputs,
639                      const llvm::opt::ArgList &TCArgs,
640                      const char *LinkingOutput) const override;
641  };
642} // end namespace XCore.
643
644
645} // end namespace toolchains
646} // end namespace driver
647} // end namespace clang
648
649#endif // CLANG_LIB_DRIVER_TOOLS_H_
650