summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
commita9d87bc6ac7d705916c6be494ebdb205b6f24d29 (patch)
tree8be118d6f0c61e6dc9150bdf5cd6ad153aca0116 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parent49709e75bb6235f8999df63242389ed4d3a3457f (diff)
downloadbcm5719-llvm-a9d87bc6ac7d705916c6be494ebdb205b6f24d29.tar.gz
bcm5719-llvm-a9d87bc6ac7d705916c6be494ebdb205b6f24d29.zip
Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the extremely-lossy NestedNameSpecifier/SourceRange pair it used to use, improving source-location information. Various infrastructure updates to support NestedNameSpecifierLoc: - AST/PCH (de-)serialization - Recursive AST visitor - libclang traversal (including the first tests of this functionality) llvm-svn: 126459
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index de4cd46e7a9..e1a70651972 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1661,12 +1661,12 @@ 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->getTargetNestedNameDecl(),
- D->getNestedNameRange(),
- TemplateArgs);
+ NestedNameSpecifier *NNS
+ = SemaRef.SubstNestedNameSpecifier(D->getQualifier(),
+ D->getQualifierRange(),
+ TemplateArgs);
if (!NNS)
- return 0;
+ return 0;
// The name info is non-dependent, so no transformation
// is required.
@@ -1680,16 +1680,18 @@ 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->getNestedNameRange(),
D->getUsingLocation(),
- NNS,
+ SS.getWithLocInContext(SemaRef.Context),
NameInfo,
D->isTypeName());
- CXXScopeSpec SS;
- SS.MakeTrivial(SemaRef.Context, NNS, D->getNestedNameRange());
-
if (CheckRedeclaration) {
Prev.setHideTags(false);
SemaRef.LookupQualifiedName(Prev, Owner);
@@ -1749,14 +1751,13 @@ Decl *TemplateDeclInstantiator::VisitUsingShadowDecl(UsingShadowDecl *D) {
Decl * TemplateDeclInstantiator
::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) {
NestedNameSpecifier *NNS =
- SemaRef.SubstNestedNameSpecifier(D->getTargetNestedNameSpecifier(),
- D->getTargetNestedNameRange(),
+ SemaRef.SubstNestedNameSpecifier(D->getQualifier(), D->getQualifierRange(),
TemplateArgs);
if (!NNS)
return 0;
CXXScopeSpec SS;
- SS.MakeTrivial(SemaRef.Context, NNS, D->getTargetNestedNameRange());
+ SS.MakeTrivial(SemaRef.Context, NNS, D->getQualifierRange());
// Since NameInfo refers to a typename, it cannot be a C++ special name.
// Hence, no tranformation is required for it.
@@ -1775,14 +1776,13 @@ Decl * TemplateDeclInstantiator
Decl * TemplateDeclInstantiator
::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
NestedNameSpecifier *NNS =
- SemaRef.SubstNestedNameSpecifier(D->getTargetNestedNameSpecifier(),
- D->getTargetNestedNameRange(),
+ SemaRef.SubstNestedNameSpecifier(D->getQualifier(), D->getQualifierRange(),
TemplateArgs);
if (!NNS)
return 0;
CXXScopeSpec SS;
- SS.MakeTrivial(SemaRef.Context, NNS, D->getTargetNestedNameRange());
+ SS.MakeTrivial(SemaRef.Context, NNS, D->getQualifierRange());
DeclarationNameInfo NameInfo
= SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
OpenPOWER on IntegriCloud