Line data Source code
1 : //
2 : // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
3 : // Use of this source code is governed by a BSD-style license that can be
4 : // found in the LICENSE file.
5 : //
6 :
7 : #ifndef COMPILER_PREPROCESSOR_MACRO_H_
8 : #define COMPILER_PREPROCESSOR_MACRO_H_
9 :
10 : #include <map>
11 : #include <string>
12 : #include <vector>
13 :
14 : namespace pp
15 : {
16 :
17 : struct Token;
18 :
19 0 : struct Macro
20 : {
21 : enum Type
22 : {
23 : kTypeObj,
24 : kTypeFunc
25 : };
26 : typedef std::vector<std::string> Parameters;
27 : typedef std::vector<Token> Replacements;
28 :
29 0 : Macro() : predefined(false), disabled(false), expansionCount(0), type(kTypeObj) {}
30 : bool equals(const Macro &other) const;
31 :
32 : bool predefined;
33 : mutable bool disabled;
34 : mutable int expansionCount;
35 :
36 : Type type;
37 : std::string name;
38 : Parameters parameters;
39 : Replacements replacements;
40 : };
41 :
42 : typedef std::map<std::string, Macro> MacroSet;
43 :
44 : void PredefineMacro(MacroSet *macroSet, const char *name, int value);
45 :
46 : } // namespace pp
47 :
48 : #endif // COMPILER_PREPROCESSOR_MACRO_H_
|