[cfe-commits] r125635 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/Index/complete-properties.m

Douglas Gregor dgregor at apple.com
Tue Feb 15 17:39:26 PST 2011


Author: dgregor
Date: Tue Feb 15 19:39:26 2011
New Revision: 125635

URL: http://llvm.org/viewvc/llvm-project?rev=125635&view=rev
Log:
When searching for visible declarations (e.g., for code completion),
be sure to look at all of the Objective-C class declarations within a
@class. Fixes <rdar://problem/8876207>.

Modified:
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/Index/complete-properties.m

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=125635&r1=125634&r2=125635&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Feb 15 19:39:26 2011
@@ -2484,7 +2484,17 @@
             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())

Modified: cfe/trunk/test/Index/complete-properties.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-properties.m?rev=125635&r1=125634&r2=125635&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-properties.m (original)
+++ cfe/trunk/test/Index/complete-properties.m Tue Feb 15 19:39:26 2011
@@ -1,6 +1,6 @@
 /* Note: the RUN lines are near the end of the file, since line/column
  matter for this test. */
-
+ at class MyClass;
 @interface I1 
 {
   id StoredProp3;
@@ -54,3 +54,6 @@
 // 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)
+





More information about the cfe-commits mailing list