diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-03-30 12:34:17 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-03-30 12:35:00 +0200 |
commit | c3d7928ac88485e46ae92421c677fb33f3829ae6 (patch) | |
tree | 4a028be4fc4e3652c3a773676d03f92457e8e807 /src/shared/cplusplus/Parser.cpp | |
parent | ed74fdd5cebf13b308051e8ca40db2310f1990de (diff) | |
download | qt-creator-c3d7928ac88485e46ae92421c677fb33f3829ae6.tar.gz |
Clone the TemplateArguments before caching the result.
Diffstat (limited to 'src/shared/cplusplus/Parser.cpp')
-rw-r--r-- | src/shared/cplusplus/Parser.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index f323241a18..11bef468c9 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -854,12 +854,19 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node) } } + if (_pool != _translationUnit->memoryPool()) { + MemoryPool *pool = _translationUnit->memoryPool(); + TemplateArgumentListAST *template_argument_list = node; + for (TemplateArgumentListAST *iter = template_argument_list, **ast_iter = &node; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) TemplateArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); + } + _templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node))); return true; } _templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), 0))); - return false; } |