[cfe-commits] r139621 - in /cfe/trunk: test/Index/IBOutletCollection.m tools/libclang/CIndex.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Sep 13 11:49:56 PDT 2011


Author: akirtzidis
Date: Tue Sep 13 13:49:56 2011
New Revision: 139621

URL: http://llvm.org/viewvc/llvm-project?rev=139621&view=rev
Log:
[libclang] Correct annotation and taking of cursor for objc class references
inside the IBOutletCollection attribute.

Added:
    cfe/trunk/test/Index/IBOutletCollection.m
Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Added: cfe/trunk/test/Index/IBOutletCollection.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/IBOutletCollection.m?rev=139621&view=auto
==============================================================================
--- cfe/trunk/test/Index/IBOutletCollection.m (added)
+++ cfe/trunk/test/Index/IBOutletCollection.m Tue Sep 13 13:49:56 2011
@@ -0,0 +1,18 @@
+#define IBOutletCollection(ClassName) __attribute__((iboutletcollection(ClassName)))
+
+ at interface Test {
+  IBOutletCollection(Test) Test *anOutletCollection;
+}
+ at end
+
+// RUN: c-index-test -cursor-at=%s:4:24 %s | FileCheck -check-prefix=CHECK-CURSOR %s
+// CHECK-CURSOR: ObjCClassRef=Test:3:12
+
+// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 %s | FileCheck -check-prefix=CHECK-TOK %s
+// CHECK-TOK: Identifier: "IBOutletCollection" [4:3 - 4:21] macro expansion=IBOutletCollection:1:9
+// CHECK-TOK: Punctuation: "(" [4:21 - 4:22] ObjCInterfaceDecl=Test:3:12
+// CHECK-TOK: Identifier: "Test" [4:22 - 4:26] ObjCClassRef=Test:3:12
+// CHECK-TOK: Punctuation: ")" [4:26 - 4:27] ObjCIvarDecl=anOutletCollection:4:34 (Definition)
+// CHECK-TOK: Identifier: "Test" [4:28 - 4:32] ObjCClassRef=Test:3:12
+// CHECK-TOK: Punctuation: "*" [4:33 - 4:34] ObjCIvarDecl=anOutletCollection:4:34 (Definition)
+// CHECK-TOK: Identifier: "anOutletCollection" [4:34 - 4:52] ObjCIvarDecl=anOutletCollection:4:34 (Definition)

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=139621&r1=139620&r2=139621&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Sep 13 13:49:56 2011
@@ -559,7 +559,15 @@
       }
     }
   }
-  
+
+  if (Cursor.kind == CXCursor_IBOutletCollectionAttr) {
+    IBOutletCollectionAttr *A =
+      cast<IBOutletCollectionAttr>(cxcursor::getCursorAttr(Cursor));
+    if (const ObjCInterfaceType *InterT = A->getInterface()->getAs<ObjCInterfaceType>())
+      return Visit(cxcursor::MakeCursorObjCClassRef(InterT->getInterface(),
+                                                    A->getInterfaceLoc(), TU));
+  }
+
   // Nothing to visit at the moment.
   return false;
 }





More information about the cfe-commits mailing list