Line data Source code
1 : //
2 : // Copyright (c) 2011 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 : #include "compiler/preprocessor/Macro.h"
8 :
9 : #include "common/angleutils.h"
10 : #include "compiler/preprocessor/Token.h"
11 :
12 : namespace pp
13 : {
14 :
15 0 : bool Macro::equals(const Macro &other) const
16 : {
17 0 : return (type == other.type) &&
18 0 : (name == other.name) &&
19 0 : (parameters == other.parameters) &&
20 0 : (replacements == other.replacements);
21 : }
22 :
23 0 : void PredefineMacro(MacroSet *macroSet, const char *name, int value)
24 : {
25 0 : Token token;
26 0 : token.type = Token::CONST_INT;
27 0 : token.text = ToString(value);
28 :
29 0 : Macro macro;
30 0 : macro.predefined = true;
31 0 : macro.type = Macro::kTypeObj;
32 0 : macro.name = name;
33 0 : macro.replacements.push_back(token);
34 :
35 0 : (*macroSet)[name] = macro;
36 0 : }
37 :
38 : } // namespace pp
39 :
|