blob: 0d907dd83a8235042278e9d078d321197012bb80 [file] [log] [blame]
Mikhail Glushenkovafbeae92008-05-06 16:34:12 +00001//===--- Tools.h - The LLVM Compiler Driver ---------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open
6// Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Tool abstract base class - an interface to tool descriptions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TOOLS_LLVMC2_TOOL_H
15#define LLVM_TOOLS_LLVMC2_TOOL_H
16
17#include "Action.h"
18
19#include "llvm/ADT/IntrusiveRefCntPtr.h"
20#include "llvm/System/Path.h"
21
22#include <string>
23#include <vector>
24
25namespace llvmcc {
26
27 typedef std::vector<llvm::sys::Path> PathVector;
28
29 class Tool : public llvm::RefCountedBaseVPTR<Tool> {
30 public:
31 virtual Action GenerateAction (PathVector const& inFiles,
32 llvm::sys::Path const& outFile) const = 0;
33
34 virtual Action GenerateAction (llvm::sys::Path const& inFile,
35 llvm::sys::Path const& outFile) const = 0;
36
Mikhail Glushenkovd379d162008-05-06 17:24:26 +000037 virtual const char* Name() const = 0;
38 virtual const char* InputLanguage() const = 0;
39 virtual const char* OutputLanguage() const = 0;
40 virtual const char* OutputSuffix() const = 0;
Mikhail Glushenkovafbeae92008-05-06 16:34:12 +000041
42 virtual bool IsLast() const = 0;
43 virtual bool IsJoin() const = 0;
44
45 // Helper function that is called by the auto-generated code
46 // Splits strings of the form ",-foo,-bar,-baz"
47 // TOFIX: find a better name
48 static void UnpackValues (std::string const& from,
49 std::vector<std::string>& to);
50
51 virtual ~Tool()
52 {}
53 };
54
55}
56
57#endif //LLVM_TOOLS_LLVMC2_TOOL_H