blob: 91e6dc6f442a414efb3b0408827814c15c454f63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
//===--- Compilation.h - Compilation Task Data Structure --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef CLANG_DRIVER_COMPILATION_H_
#define CLANG_DRIVER_COMPILATION_H_
#include "clang/Driver/Job.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
namespace clang {
namespace driver {
class ArgList;
class JobList;
class ToolChain;
/// Compilation - A set of tasks to perform for a single driver
/// invocation.
class Compilation {
/// The default tool chain.
ToolChain &DefaultToolChain;
/// The original (untranslated) input argument list.
ArgList *Args;
/// The list of actions.
ActionList Actions;
/// The root list of jobs.
JobList Jobs;
/// Cache of translated arguments for a particular tool chain.
llvm::DenseMap<const ToolChain*, ArgList*> TCArgs;
/// Temporary files which should be removed on exit.
llvm::SmallVector<const char*, 4> TempFiles;
/// Result files which should be removed on failure.
llvm::SmallVector<const char*, 4> ResultFiles;
public:
Compilation(ToolChain &DefaultToolChain, ArgList *Args);
~Compilation();
const ToolChain &getDefaultToolChain() const { return DefaultToolChain; }
const ArgList &getArgs() const { return *Args; }
ActionList &getActions() { return Actions; }
const ActionList &getActions() const { return Actions; }
JobList &getJobs() { return Jobs; }
/// getArgsForToolChain - Return the argument list, possibly
/// translated by the tool chain \arg TC (or by the default tool
/// chain, if TC is not specified).
const ArgList &getArgsForToolChain(const ToolChain *TC = 0);
/// addTempFile - Add a file to remove on exit, and returns its
/// argument.
const char *addTempFile(const char *Name) {
TempFiles.push_back(Name);
return Name;
}
/// addResultFile - Add a file to remove on failure, and returns its
/// argument.
const char *addResultFile(const char *Name) {
ResultFiles.push_back(Name);
return Name;
}
/// Execute - Execute the compilation jobs and return an
/// appropriate exit code.
int Execute() const;
};
} // end namespace driver
} // end namespace clang
#endif
|