blob: cae37e78f57b3fcf7149cb05bddd8903b2b1a10c (
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
|
//===--- PreprocessorOptionms.h ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
#define LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
#include <string>
#include <vector>
namespace clang {
class Preprocessor;
class LangOptions;
/// PreprocessorOptions - This class is used for passing the various options
/// used in preprocessor initialization to InitializePreprocessor().
class PreprocessorOptions {
std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
std::vector<std::pair<std::string, bool/*isPTH*/> > Includes;
std::vector<std::string> MacroIncludes;
unsigned UsePredefines : 1; /// Initialize the preprocessor with the compiler
/// and target specific predefines.
public:
PreprocessorOptions() : UsePredefines(true) {}
bool getUsePredefines() const { return UsePredefines; }
void setUsePredefines(bool Value) {
UsePredefines = Value;
}
void addMacroDef(const std::string &Name) {
Macros.push_back(std::make_pair(Name, false));
}
void addMacroUndef(const std::string &Name) {
Macros.push_back(std::make_pair(Name, true));
}
void addInclude(const std::string &Name, bool isPTH = false) {
Includes.push_back(std::make_pair(Name, isPTH));
}
void addMacroInclude(const std::string &Name) {
MacroIncludes.push_back(Name);
}
typedef std::vector<std::pair<std::string,
bool> >::const_iterator macro_iterator;
macro_iterator macro_begin() const { return Macros.begin(); }
macro_iterator macro_end() const { return Macros.end(); }
typedef std::vector<std::pair<std::string,
bool> >::const_iterator include_iterator;
include_iterator include_begin() const { return Includes.begin(); }
include_iterator include_end() const { return Includes.end(); }
typedef std::vector<std::string>::const_iterator imacro_iterator;
imacro_iterator imacro_begin() const { return MacroIncludes.begin(); }
imacro_iterator imacro_end() const { return MacroIncludes.end(); }
};
} // end namespace clang
#endif
|