summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/Parser.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-03-18 15:21:07 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2010-03-18 15:23:13 +0100
commit61a504c4273d01aecf1a149f5d9d8a3ab5e354c3 (patch)
tree4417d9e1e2f67acd3c56ec351055072e21cb6a27 /src/shared/cplusplus/Parser.cpp
parent1e2af0a77dcddd84de43879609733cd55302756f (diff)
downloadqt-creator-61a504c4273d01aecf1a149f5d9d8a3ab5e354c3.tar.gz
Ensure that the memory pool can be reused after a rewind and get rid of the segmented array.
Diffstat (limited to 'src/shared/cplusplus/Parser.cpp')
-rw-r--r--src/shared/cplusplus/Parser.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index ce5afdd5fa..39af8bc96b 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -190,30 +190,6 @@ inline bool isRightAssociative(int tokenKind)
return true; \
}
-class Parser::Rewind
-{
- Parser *_parser;
- MemoryPool::State _state;
-
-public:
- inline Rewind(Parser *parser)
- : _parser(parser) {}
-
- inline void operator()(unsigned tokenIndex)
- { rewind(tokenIndex); }
-
- inline void mark()
- { _state = _parser->_pool->state(); }
-
- inline void rewind(unsigned tokenIndex)
- {
- _parser->rewind(tokenIndex);
-
- if (_state.isValid())
- _parser->_pool->rewind(_state);
- }
-};
-
Parser::Parser(TranslationUnit *unit)
: _translationUnit(unit),
_control(_translationUnit->control()),
@@ -2476,8 +2452,8 @@ bool Parser::parseExpressionStatement(StatementAST *&node)
ExpressionAST *expression = 0;
MemoryPool *oldPool = _pool;
- MemoryPool tmp;
- _pool = &tmp;
+ _pool = &_tempPool;
+ RecursiveMemoryPool rec(&_tempPool);
if (parseExpression(expression)) {
ExpressionStatementAST *ast = new (oldPool) ExpressionStatementAST;
ast->expression = expression->clone(oldPool);