summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/compiler/preprocessor/MacroExpander.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
commit4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0 (patch)
treef000dd831240707a03b8c806db292c2a15cde3ce /gfx/angle/src/compiler/preprocessor/MacroExpander.h
parent3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff)
downloadUXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.gz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.lz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.xz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.zip
Roll back to ANGLE/2845
Diffstat (limited to 'gfx/angle/src/compiler/preprocessor/MacroExpander.h')
-rwxr-xr-xgfx/angle/src/compiler/preprocessor/MacroExpander.h38
1 files changed, 25 insertions, 13 deletions
diff --git a/gfx/angle/src/compiler/preprocessor/MacroExpander.h b/gfx/angle/src/compiler/preprocessor/MacroExpander.h
index 3a8450f5e..dbf980308 100755
--- a/gfx/angle/src/compiler/preprocessor/MacroExpander.h
+++ b/gfx/angle/src/compiler/preprocessor/MacroExpander.h
@@ -7,11 +7,13 @@
#ifndef COMPILER_PREPROCESSOR_MACROEXPANDER_H_
#define COMPILER_PREPROCESSOR_MACROEXPANDER_H_
+#include <cassert>
#include <memory>
#include <vector>
-#include "compiler/preprocessor/Lexer.h"
-#include "compiler/preprocessor/Macro.h"
+#include "Lexer.h"
+#include "Macro.h"
+#include "pp_utils.h"
namespace pp
{
@@ -28,6 +30,8 @@ class MacroExpander : public Lexer
void lex(Token *token) override;
private:
+ PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
+
void getToken(Token *token);
void ungetToken(const Token &token);
bool isNextTokenLeftParen();
@@ -50,14 +54,28 @@ class MacroExpander : public Lexer
struct MacroContext
{
- MacroContext();
- bool empty() const;
- const Token &get();
- void unget();
-
const Macro *macro;
std::size_t index;
std::vector<Token> replacements;
+
+ MacroContext()
+ : macro(0),
+ index(0)
+ {
+ }
+ bool empty() const
+ {
+ return index == replacements.size();
+ }
+ const Token &get()
+ {
+ return replacements[index++];
+ }
+ void unget()
+ {
+ assert(index > 0);
+ --index;
+ }
};
Lexer *mLexer;
@@ -66,12 +84,6 @@ class MacroExpander : public Lexer
std::unique_ptr<Token> mReserveToken;
std::vector<MacroContext *> mContextStack;
- size_t mTotalTokensInContexts;
-
- bool mDeferReenablingMacros;
- std::vector<const Macro *> mMacrosToReenable;
-
- class ScopedMacroReenabler;
};
} // namespace pp