clang API Documentation
00001 //===--- Tool.h - Compilation Tools -----------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef CLANG_DRIVER_TOOL_H_ 00011 #define CLANG_DRIVER_TOOL_H_ 00012 00013 #include "clang/Basic/LLVM.h" 00014 00015 namespace clang { 00016 namespace driver { 00017 class ArgList; 00018 class Compilation; 00019 class InputInfo; 00020 class Job; 00021 class JobAction; 00022 class ToolChain; 00023 00024 typedef SmallVector<InputInfo, 4> InputInfoList; 00025 00026 /// Tool - Information on a specific compilation tool. 00027 class Tool { 00028 /// The tool name (for debugging). 00029 const char *Name; 00030 00031 /// The human readable name for the tool, for use in diagnostics. 00032 const char *ShortName; 00033 00034 /// The tool chain this tool is a part of. 00035 const ToolChain &TheToolChain; 00036 00037 public: 00038 Tool(const char *Name, const char *ShortName, 00039 const ToolChain &TC); 00040 00041 public: 00042 virtual ~Tool(); 00043 00044 const char *getName() const { return Name; } 00045 00046 const char *getShortName() const { return ShortName; } 00047 00048 const ToolChain &getToolChain() const { return TheToolChain; } 00049 00050 virtual bool hasIntegratedAssembler() const { return false; } 00051 virtual bool hasIntegratedCPP() const = 0; 00052 virtual bool isLinkJob() const { return false; } 00053 00054 /// \brief Does this tool have "good" standardized diagnostics, or should the 00055 /// driver add an additional "command failed" diagnostic on failures. 00056 virtual bool hasGoodDiagnostics() const { return false; } 00057 00058 /// ConstructJob - Construct jobs to perform the action \arg JA, 00059 /// writing to \arg Output and with \arg Inputs. 00060 /// 00061 /// \param TCArgs - The argument list for this toolchain, with any 00062 /// tool chain specific translations applied. 00063 /// \param LinkingOutput - If this output will eventually feed the 00064 /// linker, then this is the final output name of the linked image. 00065 virtual void ConstructJob(Compilation &C, const JobAction &JA, 00066 const InputInfo &Output, 00067 const InputInfoList &Inputs, 00068 const ArgList &TCArgs, 00069 const char *LinkingOutput) const = 0; 00070 }; 00071 00072 } // end namespace driver 00073 } // end namespace clang 00074 00075 #endif