Allow Objective-C entities to be declared within a transparent context
nested in the translation unit. This fixes <rdar://problem/6476070>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61832 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 18e78a0..08c9bde 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -60,8 +60,7 @@
else
return TUCtx();
- while (Ctx->isTransparentContext())
- Ctx = Ctx->getParent();
+ Ctx = Ctx->getLookupContext();
if (isa<TranslationUnitDecl>(Ctx))
return TUCtx();
@@ -132,8 +131,7 @@
/// true if 'D' belongs to the given declaration context.
bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
ASTContext &Context, Scope *S) const {
- while (Ctx->isTransparentContext())
- Ctx = Ctx->getParent();
+ Ctx = Ctx->getLookupContext();
if (Ctx->isFunctionOrMethod()) {
// Ignore the scopes associated within transparent declaration contexts.