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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
//===--- Driver.h - Clang GCC Compatible Driver -----------------*- 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_DRIVER_H_
#define CLANG_DRIVER_DRIVER_H_
#include "clang/Basic/Diagnostic.h"
#include "clang/Driver/Util.h"
#include <list>
#include <set>
#include <string>
namespace clang {
namespace driver {
class Action;
class ArgList;
class Compilation;
class HostInfo;
class OptTable;
/// Driver - Encapsulate logic for constructing compilation processes
/// from a set of gcc-driver-like command line arguments.
class Driver {
OptTable *Opts;
Diagnostic &Diags;
/// ParseArgStrings - Parse the given list of strings into an
/// ArgList.
ArgList *ParseArgStrings(const char **ArgBegin, const char **ArgEnd);
// Diag - Forwarding function for diagnostics.
DiagnosticBuilder Diag(unsigned DiagID) {
return Diags.Report(FullSourceLoc(), DiagID);
}
// FIXME: Privatize once interface is stable.
public:
/// The name the driver was invoked as.
std::string Name;
/// The path the driver executable was in, as invoked from the
/// command line.
std::string Dir;
/// Default host triple.
std::string DefaultHostTriple;
/// Host information for the platform the driver is running as. This
/// will generally be the actual host platform, but not always.
HostInfo *Host;
/// Information about the host which can be overriden by the user.
std::string HostBits, HostMachine, HostSystem, HostRelease;
/// Whether the driver should follow g++ like behavior.
bool CCCIsCXX : 1;
/// Echo commands while executing (in -v style).
bool CCCEcho : 1;
/// Don't use clang for any tasks.
bool CCCNoClang : 1;
/// Don't use clang for handling C++ and Objective-C++ inputs.
bool CCCNoClangCXX : 1;
/// Don't use clang as a preprocessor (clang's preprocessor will
/// still be used where an integrated CPP would).
bool CCCNoClangCPP : 1;
/// Only use clang for the given architectures. Only used when
/// non-empty.
std::set<std::string> CCCClangArchs;
/// Certain options suppress the 'no input files' warning.
bool SuppressMissingInputWarning : 1;
std::list<std::string> TempFiles;
std::list<std::string> ResultFiles;
public:
Driver(const char *_Name, const char *_Dir,
const char *_DefaultHostTriple,
Diagnostic &_Diags);
~Driver();
const OptTable &getOpts() const { return *Opts; }
/// BuildCompilation - Construct a compilation object for a command
/// line argument vector.
Compilation *BuildCompilation(int argc, const char **argv);
/// PrintOptions - Print the list of arguments.
void PrintOptions(const ArgList &Args) const;
/// PrintActions - Print the list of actions.
void PrintActions(const ActionList &Actions) const;
/// GetHostInfo - Construct a new host info object for the given
/// host triple.
static HostInfo *GetHostInfo(const char *HostTriple);
/// BuildUniversalActions - Construct the list of actions to perform
/// for the given arguments, which may require a universal build.
///
/// \param Args - The input arguments.
/// \param Actions - The list to store the resulting actions onto.
void BuildUniversalActions(ArgList &Args, ActionList &Actions);
/// BuildActions - Construct the list of actions to perform for the
/// given arguments, which are only done for a single architecture.
///
/// \param Args - The input arguments.
/// \param Actions - The list to store the resulting actions onto.
void BuildActions(ArgList &Args, ActionList &Actions);
};
} // end namespace driver
} // end namespace clang
#endif
|