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/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index a21d5db..faaa104 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -567,6 +567,13 @@
   return const_cast<DeclContext*>(this)->lookup(Context, Name);
 }
 
+DeclContext *DeclContext::getLookupContext() {
+  DeclContext *Ctx = this;
+  while (Ctx->isTransparentContext())
+    Ctx = Ctx->getParent();
+  return Ctx;
+}
+
 void DeclContext::insert(ASTContext &Context, ScopedDecl *D) {
   DeclContext *PrimaryContext = getPrimaryContext(Context);
   if (PrimaryContext != this) {