• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- Tool.h - Compilation Tools -----------------------------*- 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_DRIVER_TOOL_H_
11 #define CLANG_DRIVER_TOOL_H_
12 
13 #include "clang/Basic/LLVM.h"
14 
15 namespace clang {
16 namespace driver {
17   class ArgList;
18   class Compilation;
19   class InputInfo;
20   class Job;
21   class JobAction;
22   class ToolChain;
23 
24   typedef SmallVector<InputInfo, 4> InputInfoList;
25 
26 /// Tool - Information on a specific compilation tool.
27 class Tool {
28   /// The tool name (for debugging).
29   const char *Name;
30 
31   /// The human readable name for the tool, for use in diagnostics.
32   const char *ShortName;
33 
34   /// The tool chain this tool is a part of.
35   const ToolChain &TheToolChain;
36 
37 public:
38   Tool(const char *Name, const char *ShortName,
39        const ToolChain &TC);
40 
41 public:
42   virtual ~Tool();
43 
getName()44   const char *getName() const { return Name; }
45 
getShortName()46   const char *getShortName() const { return ShortName; }
47 
getToolChain()48   const ToolChain &getToolChain() const { return TheToolChain; }
49 
hasIntegratedAssembler()50   virtual bool hasIntegratedAssembler() const { return false; }
51   virtual bool hasIntegratedCPP() const = 0;
isLinkJob()52   virtual bool isLinkJob() const { return false; }
53 
54   /// \brief Does this tool have "good" standardized diagnostics, or should the
55   /// driver add an additional "command failed" diagnostic on failures.
hasGoodDiagnostics()56   virtual bool hasGoodDiagnostics() const { return false; }
57 
58   /// ConstructJob - Construct jobs to perform the action \arg JA,
59   /// writing to \arg Output and with \arg Inputs.
60   ///
61   /// \param TCArgs - The argument list for this toolchain, with any
62   /// tool chain specific translations applied.
63   /// \param LinkingOutput - If this output will eventually feed the
64   /// linker, then this is the final output name of the linked image.
65   virtual void ConstructJob(Compilation &C, const JobAction &JA,
66                             const InputInfo &Output,
67                             const InputInfoList &Inputs,
68                             const ArgList &TCArgs,
69                             const char *LinkingOutput) const = 0;
70 };
71 
72 } // end namespace driver
73 } // end namespace clang
74 
75 #endif
76