]> granicus.if.org Git - clang/commitdiff
When searching for visible declarations (e.g., for code completion),
authorDouglas Gregor <dgregor@apple.com>
Wed, 16 Feb 2011 01:39:26 +0000 (01:39 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 16 Feb 2011 01:39:26 +0000 (01:39 +0000)
be sure to look at all of the Objective-C class declarations within a
@class. Fixes <rdar://problem/8876207>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125635 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp
test/Index/complete-properties.m

index ec633d177c44f960fcbdfc1fdc190f34c417b833..68eccfc28025f95916dc343e32276ea1fce18374 100644 (file)
@@ -2484,7 +2484,17 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
             Visited.add(*P);
           }
         }
+      } else if (ObjCClassDecl *Class = dyn_cast<ObjCClassDecl>(*D)) {
+        for (ObjCClassDecl::iterator I = Class->begin(), IEnd = Class->end();
+             I != IEnd; ++I) {
+          ObjCInterfaceDecl *IFace = I->getInterface();
+          if (Result.isAcceptableDecl(IFace)) {
+            Consumer.FoundDecl(IFace, Visited.checkHidden(IFace), InBaseClass);
+            Visited.add(IFace);
+          }
+        }
       }
+      
       // Visit transparent contexts and inline namespaces inside this context.
       if (DeclContext *InnerCtx = dyn_cast<DeclContext>(*D)) {
         if (InnerCtx->isTransparentContext() || InnerCtx->isInlineNamespace())
index 0a19f11133455a447f99050771b68badf9865680..725f180f7c29f06957b05a84858c3e01078afd84 100644 (file)
@@ -1,6 +1,6 @@
 /* Note: the RUN lines are near the end of the file, since line/column
  matter for this test. */
-
+@class MyClass;
 @interface I1 
 {
   id StoredProp3;
@@ -54,3 +54,6 @@ id test(I3 *i3) {
 // CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3} (35)
 // CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4} (35)
 
+// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC6 %s
+// CHECK-CC6: ObjCInterfaceDecl:{TypedText MyClass} (50)
+