aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-01 00:40:08 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-01 00:40:08 +0000
commit77bb1aa78bcd26e42c0382043e65a2b03242be4d (patch)
tree89f763410c2fae9ecf90794c55bef618b65a9d42 /lib/Sema/SemaDecl.cpp
parentcdb65d8724428664af7394451863b4aa6123f52b (diff)
It turns out that basically every caller to RequireCompleteDeclContext
already knows what context it's looking in. Just pass that context in instead of (questionably) recalculating it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7a70c32877..3e4c923285 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -97,7 +97,8 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
return 0;
}
- if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(*SS))
+ if (!LookupCtx->isDependentContext() &&
+ RequireCompleteDeclContext(*SS, LookupCtx))
return 0;
}
@@ -2030,7 +2031,7 @@ Sema::HandleDeclarator(Scope *S, Declarator &D,
bool IsDependentContext = DC->isDependentContext();
if (!IsDependentContext &&
- RequireCompleteDeclContext(D.getCXXScopeSpec()))
+ RequireCompleteDeclContext(D.getCXXScopeSpec(), DC))
return DeclPtrTy();
if (isa<CXXRecordDecl>(DC) && !cast<CXXRecordDecl>(DC)->hasDefinition()) {
@@ -4940,12 +4941,18 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
IsDependent = true;
return DeclPtrTy();
}
+ } else {
+ DC = computeDeclContext(SS, true);
+ if (!DC) {
+ Diag(SS.getRange().getBegin(), diag::err_dependent_nested_name_spec)
+ << SS.getRange();
+ return DeclPtrTy();
+ }
}
- if (RequireCompleteDeclContext(SS))
+ if (RequireCompleteDeclContext(SS, DC))
return DeclPtrTy::make((Decl *)0);
- DC = computeDeclContext(SS, true);
SearchDC = DC;
// Look-up name inside 'foo::'.
LookupQualifiedName(Previous, DC);