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