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 <memory>
12#include <string>
13#include <vector>
14
15namespace angle
16{
17
18namespace pp
19{
20
21struct Token;
22
23struct Macro
24{
25 enum Type
26 {
27 kTypeObj,
28 kTypeFunc
29 };
30 typedef std::vector<std::string> Parameters;
31 typedef std::vector<Token> Replacements;
32
33 Macro();
34 ~Macro();
35 bool equals(const Macro &other) const;
36
37 bool predefined;
38 mutable bool disabled;
39 mutable int expansionCount;
40
41 Type type;
42 std::string name;
43 Parameters parameters;
44 Replacements replacements;
45};
46
47typedef std::map<std::string, std::shared_ptr<Macro>> MacroSet;
48
49void PredefineMacro(MacroSet *macroSet, const char *name, int value);
50
51} // namespace pp
52
53} // namespace angle
54
55#endif // COMPILER_PREPROCESSOR_MACRO_H_
56