2008-05-06 16:34:12 +00:00
|
|
|
//===--- Tools.h - The LLVM Compiler Driver ---------------------*- C++ -*-===//
|
2008-03-23 08:57:20 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open
|
|
|
|
// Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-05-06 16:34:12 +00:00
|
|
|
// Tool abstract base class - an interface to tool descriptions.
|
2008-03-23 08:57:20 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-05-06 16:34:12 +00:00
|
|
|
#ifndef LLVM_TOOLS_LLVMC2_TOOL_H
|
|
|
|
#define LLVM_TOOLS_LLVMC2_TOOL_H
|
2008-03-23 08:57:20 +00:00
|
|
|
|
2008-05-06 16:34:12 +00:00
|
|
|
#include "Action.h"
|
2008-03-23 08:57:20 +00:00
|
|
|
|
|
|
|
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
|
|
|
#include "llvm/System/Path.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2008-05-06 18:08:59 +00:00
|
|
|
namespace llvmc {
|
2008-03-23 08:57:20 +00:00
|
|
|
|
|
|
|
typedef std::vector<llvm::sys::Path> PathVector;
|
|
|
|
|
2008-05-07 21:50:19 +00:00
|
|
|
/// Tool - A class
|
2008-03-23 08:57:20 +00:00
|
|
|
class Tool : public llvm::RefCountedBaseVPTR<Tool> {
|
|
|
|
public:
|
|
|
|
|
2008-05-06 17:26:53 +00:00
|
|
|
virtual ~Tool() {}
|
|
|
|
|
|
|
|
virtual Action GenerateAction (const PathVector& inFiles,
|
|
|
|
const llvm::sys::Path& outFile) const = 0;
|
|
|
|
|
|
|
|
virtual Action GenerateAction (const llvm::sys::Path& inFile,
|
|
|
|
const llvm::sys::Path& outFile) const = 0;
|
2008-03-23 08:57:20 +00:00
|
|
|
|
2008-05-06 17:24:26 +00:00
|
|
|
virtual const char* Name() const = 0;
|
|
|
|
virtual const char* InputLanguage() const = 0;
|
|
|
|
virtual const char* OutputLanguage() const = 0;
|
|
|
|
virtual const char* OutputSuffix() const = 0;
|
2008-03-23 08:57:20 +00:00
|
|
|
|
|
|
|
virtual bool IsLast() const = 0;
|
|
|
|
virtual bool IsJoin() const = 0;
|
2008-05-06 17:26:53 +00:00
|
|
|
};
|
|
|
|
|
2008-05-07 21:50:19 +00:00
|
|
|
/// JoinTool - A Tool that has an associated input file list.
|
2008-05-06 17:26:53 +00:00
|
|
|
class JoinTool : public Tool {
|
|
|
|
public:
|
2008-05-06 18:07:48 +00:00
|
|
|
void AddToJoinList(const llvm::sys::Path& P) { JoinList_.push_back(P); }
|
|
|
|
void ClearJoinList() { JoinList_.clear(); }
|
|
|
|
bool JoinListEmpty() const { return JoinList_.empty(); }
|
2008-05-06 17:26:53 +00:00
|
|
|
|
|
|
|
Action GenerateAction(const llvm::sys::Path& outFile) const
|
2008-05-06 18:07:48 +00:00
|
|
|
{ return GenerateAction(JoinList_, outFile); }
|
|
|
|
// We shouldn't shadow base class's version of GenerateAction.
|
2008-05-06 17:26:53 +00:00
|
|
|
using Tool::GenerateAction;
|
2008-03-23 08:57:20 +00:00
|
|
|
|
2008-05-06 17:26:53 +00:00
|
|
|
private:
|
2008-05-06 18:07:48 +00:00
|
|
|
PathVector JoinList_;
|
2008-03-23 08:57:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:34:12 +00:00
|
|
|
#endif //LLVM_TOOLS_LLVMC2_TOOL_H
|