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