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