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