diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-15 10:12:16 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-15 10:12:16 +0000 |
| commit | 3e11ebebc83643747f15bcafa28b3b7e232f6cc1 (patch) | |
| tree | 5bc9d793fb1e75fccc7da56e4314642242d497d7 /clang/lib/Sema/SemaTemplate.cpp | |
| parent | 1e3a1a7eff8549fbb5295e4c2014f9b9a7a7b30f (diff) | |
| download | bcm5719-llvm-3e11ebebc83643747f15bcafa28b3b7e232f6cc1.tar.gz bcm5719-llvm-3e11ebebc83643747f15bcafa28b3b7e232f6cc1.zip | |
Remember declaration scope qualifiers in the AST. Imposes no memory overhead
on unqualified declarations.
Patch by Enea Zaffanella! Minimal adjustments: allocate the ExtInfo nodes
with the ASTContext and delete them during Destroy(). I audited a bunch of
Destroy methods at the same time, to ensure that the correct teardown was
being done.
llvm-svn: 98540
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 79298acc229..434d5563e1b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -697,6 +697,12 @@ Sema::ActOnTemplateParameterList(unsigned Depth, RAngleLoc); } +static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) { + if (SS.isSet()) + T->setQualifierInfo(static_cast<NestedNameSpecifier*>(SS.getScopeRep()), + SS.getRange()); +} + Sema::DeclResult Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, const CXXScopeSpec &SS, @@ -864,6 +870,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, PrevClassTemplate? PrevClassTemplate->getTemplatedDecl() : 0, /*DelayTypeCreation=*/true); + SetNestedNameSpecifier(NewClass, SS); ClassTemplateDecl *NewTemplate = ClassTemplateDecl::Create(Context, SemanticContext, NameLoc, @@ -3491,6 +3498,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TemplateArgs, CanonType, PrevPartial); + SetNestedNameSpecifier(Partial, SS); if (PrevPartial) { ClassTemplate->getPartialSpecializations().RemoveNode(PrevPartial); @@ -3547,6 +3555,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, ClassTemplate, Converted, PrevDecl); + SetNestedNameSpecifier(Specialization, SS); if (PrevDecl) { ClassTemplate->getSpecializations().RemoveNode(PrevDecl); @@ -4328,6 +4337,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, TemplateNameLoc, ClassTemplate, Converted, PrevDecl); + SetNestedNameSpecifier(Specialization, SS); if (PrevDecl) { // Remove the previous declaration from the folding set, since we want |

