diff options
Diffstat (limited to 'src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp')
-rw-r--r-- | src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp index 13cb14e3dc..4c4d5fd2e2 100644 --- a/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp +++ b/src/3rdparty/angle/src/compiler/preprocessor/Macro.cpp @@ -6,6 +6,8 @@ #include "Macro.h" +#include <sstream> + #include "Token.h" namespace pp @@ -19,5 +21,23 @@ bool Macro::equals(const Macro &other) const (replacements == other.replacements); } +void PredefineMacro(MacroSet *macroSet, const char *name, int value) +{ + std::ostringstream stream; + stream << value; + + Token token; + token.type = Token::CONST_INT; + token.text = stream.str(); + + Macro macro; + macro.predefined = true; + macro.type = Macro::kTypeObj; + macro.name = name; + macro.replacements.push_back(token); + + (*macroSet)[name] = macro; +} + } // namespace pp |