diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-25 15:54:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-25 15:54:31 +0000 |
commit | 0499ab6c351d501ead6bc13e5d7de859806ad1eb (patch) | |
tree | 3653c626ba9f84c48be4871ce5c528b680f6dd33 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 54f43b87dc9be25f8708b2620b8510d12f8b7823 (diff) | |
download | bcm5719-llvm-0499ab6c351d501ead6bc13e5d7de859806ad1eb.tar.gz bcm5719-llvm-0499ab6c351d501ead6bc13e5d7de859806ad1eb.zip |
Maintain nested-name-specifier source-location information through
instantiation of using declarations (all three forms).
llvm-svn: 126485
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index f437cd30924..c96430a5d5d 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1661,11 +1661,10 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) { // template struct t<int>; // Here, in using s1::f1, s1 refers to t<T>::s1; // we need to substitute for t<int>::s1. - NestedNameSpecifier *NNS - = SemaRef.SubstNestedNameSpecifier(D->getQualifier(), - D->getQualifierRange(), - TemplateArgs); - if (!NNS) + NestedNameSpecifierLoc QualifierLoc + = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(), + TemplateArgs); + if (!QualifierLoc) return 0; // The name info is non-dependent, so no transformation @@ -1680,18 +1679,14 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) { LookupResult Prev(SemaRef, NameInfo, Sema::LookupUsingDeclName, Sema::ForRedeclaration); - CXXScopeSpec SS; - if (NNS == D->getQualifier()) - SS.Adopt(D->getQualifierLoc()); - else - SS.MakeTrivial(SemaRef.Context, NNS, D->getQualifierRange()); - UsingDecl *NewUD = UsingDecl::Create(SemaRef.Context, Owner, D->getUsingLocation(), - SS.getWithLocInContext(SemaRef.Context), + QualifierLoc, NameInfo, D->isTypeName()); + CXXScopeSpec SS; + SS.Adopt(QualifierLoc); if (CheckRedeclaration) { Prev.setHideTags(false); SemaRef.LookupQualifiedName(Prev, Owner); @@ -1750,14 +1745,14 @@ Decl *TemplateDeclInstantiator::VisitUsingShadowDecl(UsingShadowDecl *D) { Decl * TemplateDeclInstantiator ::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) { - NestedNameSpecifier *NNS = - SemaRef.SubstNestedNameSpecifier(D->getQualifier(), D->getQualifierRange(), - TemplateArgs); - if (!NNS) + NestedNameSpecifierLoc QualifierLoc + = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(), + TemplateArgs); + if (!QualifierLoc) return 0; CXXScopeSpec SS; - SS.MakeTrivial(SemaRef.Context, NNS, D->getQualifierRange()); + SS.Adopt(QualifierLoc); // Since NameInfo refers to a typename, it cannot be a C++ special name. // Hence, no tranformation is required for it. @@ -1775,14 +1770,13 @@ Decl * TemplateDeclInstantiator Decl * TemplateDeclInstantiator ::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) { - NestedNameSpecifier *NNS = - SemaRef.SubstNestedNameSpecifier(D->getQualifier(), D->getQualifierRange(), - TemplateArgs); - if (!NNS) + NestedNameSpecifierLoc QualifierLoc + = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(), TemplateArgs); + if (!QualifierLoc) return 0; - + CXXScopeSpec SS; - SS.MakeTrivial(SemaRef.Context, NNS, D->getQualifierRange()); + SS.Adopt(QualifierLoc); DeclarationNameInfo NameInfo = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs); |