aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index af1b8a276e..3c8ab435a8 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -649,12 +649,9 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
for (; S; S = S->getParent()) {
DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity());
- if (!Ctx || Ctx->isTransparentContext())
+ if (Ctx && Ctx->isTransparentContext())
continue;
- assert(Ctx && Ctx->isFileContext() &&
- "We should have been looking only at file context here already.");
-
// Check whether the IdResolver has anything in this scope.
bool Found = false;
for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) {
@@ -668,16 +665,21 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
}
}
- // Look into context considering using-directives.
- if (CppNamespaceLookup(R, Context, Ctx, UDirs))
- Found = true;
+ if (Ctx) {
+ assert(Ctx->isFileContext() &&
+ "We should have been looking only at file context here already.");
+
+ // Look into context considering using-directives.
+ if (CppNamespaceLookup(R, Context, Ctx, UDirs))
+ Found = true;
+ }
if (Found) {
R.resolveKind();
return true;
}
- if (R.isForRedeclaration() && !Ctx->isTransparentContext())
+ if (R.isForRedeclaration() && Ctx && !Ctx->isTransparentContext())
return false;
}