1 //===--- Tools.h - The LLVM Compiler Driver ---------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Tool abstract base class - an interface to tool descriptions.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TOOLS_LLVMC2_TOOL_H
15 #define LLVM_TOOLS_LLVMC2_TOOL_H
19 #include "llvm/ADT/IntrusiveRefCntPtr.h"
20 #include "llvm/System/Path.h"
27 typedef std::vector<llvm::sys::Path> PathVector;
29 class Tool : public llvm::RefCountedBaseVPTR<Tool> {
34 virtual Action GenerateAction (const PathVector& inFiles,
35 const llvm::sys::Path& outFile) const = 0;
37 virtual Action GenerateAction (const llvm::sys::Path& inFile,
38 const llvm::sys::Path& outFile) const = 0;
40 virtual const char* Name() const = 0;
41 virtual const char* InputLanguage() const = 0;
42 virtual const char* OutputLanguage() const = 0;
43 virtual const char* OutputSuffix() const = 0;
45 virtual bool IsLast() const = 0;
46 virtual bool IsJoin() const = 0;
49 // Join tools have an input file list associated with them.
50 class JoinTool : public Tool {
52 void AddToJoinList(const llvm::sys::Path& P) { JoinList_.push_back(P); }
53 void ClearJoinList() { JoinList_.clear(); }
54 bool JoinListEmpty() const { return JoinList_.empty(); }
56 Action GenerateAction(const llvm::sys::Path& outFile) const
57 { return GenerateAction(JoinList_, outFile); }
58 // We shouldn't shadow base class's version of GenerateAction.
59 using Tool::GenerateAction;
67 #endif //LLVM_TOOLS_LLVMC2_TOOL_H