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. 67 /// 68 /// \param TCArgs - The argument list for this toolchain, with any 69 /// tool chain specific translations applied. 70 /// \param LinkingOutput - If this output will eventually feed the 71 /// linker, then this is the final output name of the linked image. 72 virtual void ConstructJob(Compilation &C, const JobAction &JA, 73 const InputInfo &Output, 74 const InputInfoList &Inputs, 75 const llvm::opt::ArgList &TCArgs, 76 const char *LinkingOutput) const = 0; 77 }; 78 79 } // end namespace driver 80 } // end namespace clang 81 82 #endif 83