diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-08-12 11:46:03 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-08-12 11:46:03 +0000 |
commit | ef3dce817d43faadbf21ce9102d33a9d84b02e09 (patch) | |
tree | a7c5fd0d8c6d46bc8876c1495d96541a4448c02d /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 2a479929f70d32f626778ef6e70ef46d3a37f74e (diff) |
Added locations and type source info for DeclarationName inside UsingDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index fe21ace686..cbdd9d51c2 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1544,22 +1544,22 @@ Decl *TemplateDeclInstantiator::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) { Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) { // The nested name specifier is non-dependent, so no transformation - // is required. + // is required. The same holds for the name info. + DeclarationNameInfo NameInfo = D->getNameInfo(); // We only need to do redeclaration lookups if we're in a class // scope (in fact, it's not really even possible in non-class // scopes). bool CheckRedeclaration = Owner->isRecord(); - LookupResult Prev(SemaRef, D->getDeclName(), D->getLocation(), - Sema::LookupUsingDeclName, Sema::ForRedeclaration); + LookupResult Prev(SemaRef, NameInfo, Sema::LookupUsingDeclName, + Sema::ForRedeclaration); UsingDecl *NewUD = UsingDecl::Create(SemaRef.Context, Owner, - D->getLocation(), D->getNestedNameRange(), D->getUsingLocation(), D->getTargetNestedNameDecl(), - D->getDeclName(), + NameInfo, D->isTypeName()); CXXScopeSpec SS; @@ -1635,10 +1635,12 @@ Decl * TemplateDeclInstantiator SS.setRange(D->getTargetNestedNameRange()); SS.setScopeRep(NNS); + // Since NameInfo refers to a typename, it cannot be a C++ special name. + // Hence, no tranformation is required for it. + DeclarationNameInfo NameInfo(D->getDeclName(), D->getLocation()); NamedDecl *UD = SemaRef.BuildUsingDeclaration(/*Scope*/ 0, D->getAccess(), - D->getUsingLoc(), SS, D->getLocation(), - D->getDeclName(), 0, + D->getUsingLoc(), SS, NameInfo, 0, /*instantiation*/ true, /*typename*/ true, D->getTypenameLoc()); if (UD) @@ -1660,10 +1662,12 @@ Decl * TemplateDeclInstantiator SS.setRange(D->getTargetNestedNameRange()); SS.setScopeRep(NNS); + DeclarationNameInfo NameInfo + = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs); + NamedDecl *UD = SemaRef.BuildUsingDeclaration(/*Scope*/ 0, D->getAccess(), - D->getUsingLoc(), SS, D->getLocation(), - D->getDeclName(), 0, + D->getUsingLoc(), SS, NameInfo, 0, /*instantiation*/ true, /*typename*/ false, SourceLocation()); if (UD) |