diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-08-26 11:41:20 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-08-26 11:41:20 +0200 |
commit | fc1b435ab4982ac96324591f6215fd2a3adb0ca0 (patch) | |
tree | 66e1950eb46ad743026e97d2dff85b90335a4bba /src/shared/cplusplus/CheckDeclaration.cpp | |
parent | f137bd3b83dbb57e029a4bdd58e8dc7b34934d39 (diff) | |
download | qt-creator-fc1b435ab4982ac96324591f6215fd2a3adb0ca0.tar.gz |
Introduced CPlusPlus::TemplateArguments and fixed a possible mem-leak when using template members.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r-- | src/shared/cplusplus/CheckDeclaration.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 08fdf712da..ab359d9c05 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -72,10 +72,10 @@ CheckDeclaration::~CheckDeclaration() { } void CheckDeclaration::check(DeclarationAST *declaration, - Scope *scope, Scope *templateParameters) + Scope *scope, TemplateParameters *templateParameters) { Scope *previousScope = switchScope(scope); - Scope *previousTemplateParameters = switchTemplateParameters(templateParameters); + TemplateParameters *previousTemplateParameters = switchTemplateParameters(templateParameters); DeclarationAST *previousDeclaration = switchDeclaration(declaration); accept(declaration); (void) switchDeclaration(previousDeclaration); @@ -97,9 +97,9 @@ Scope *CheckDeclaration::switchScope(Scope *scope) return previousScope; } -Scope *CheckDeclaration::switchTemplateParameters(Scope *templateParameters) +TemplateParameters *CheckDeclaration::switchTemplateParameters(TemplateParameters *templateParameters) { - Scope *previousTemplateParameters = _templateParameters; + TemplateParameters *previousTemplateParameters = _templateParameters; _templateParameters = templateParameters; return previousTemplateParameters; } @@ -395,13 +395,15 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast) bool CheckDeclaration::visit(TemplateDeclarationAST *ast) { - Scope *previousScope = switchScope(new Scope(_scope->owner())); + Scope *scope = new Scope(_scope->owner()); + for (DeclarationListAST *param = ast->template_parameters; param; param = param->next) { - semantic()->check(param->declaration, _scope); + semantic()->check(param->declaration, scope); } - Scope *templateParameters = switchScope(previousScope); - semantic()->check(ast->declaration, _scope, templateParameters); + semantic()->check(ast->declaration, _scope, + new TemplateParameters(_templateParameters, scope)); + return false; } |