[cfe-commits] r137634 - in /cfe/trunk: test/Index/annotate-tokens.m test/Index/get-cursor.m tools/libclang/CIndex.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Aug 15 11:44:43 PDT 2011


Author: akirtzidis
Date: Mon Aug 15 13:44:43 2011
New Revision: 137634

URL: http://llvm.org/viewvc/llvm-project?rev=137634&view=rev
Log:
[libclang] Handle AttributedTypeLoc for cursor visitation. Fixes rdar://9535717.

Modified:
    cfe/trunk/test/Index/annotate-tokens.m
    cfe/trunk/test/Index/get-cursor.m
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/test/Index/annotate-tokens.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-tokens.m?rev=137634&r1=137633&r2=137634&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-tokens.m (original)
+++ cfe/trunk/test/Index/annotate-tokens.m Mon Aug 15 13:44:43 2011
@@ -137,6 +137,11 @@
 @property (readonly, atomic) Foo *abah;
 @end
 
+ at interface rdar9535717 {
+  __weak Foo *foo;
+}
+ at end
+
 // RUN: c-index-test -test-annotate-tokens=%s:1:1:118:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s
 // CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12
 // CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12
@@ -561,3 +566,11 @@
 // CHECK-PROP-AFTER-METHOD: Identifier: "abah" [137:35 - 137:39] ObjCPropertyDecl=abah:137:35
 // CHECK-PROP-AFTER-METHOD: Punctuation: ";" [137:39 - 137:40] ObjCInterfaceDecl=Rdar8062781:134:12
 // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [138:1 - 138:2] ObjCInterfaceDecl=Rdar8062781:134:12
+
+// RUN: c-index-test -test-annotate-tokens=%s:141:1:142:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-WITH-WEAK %s
+// CHECK-WITH-WEAK: Identifier: "__weak" [141:3 - 141:9] macro expansion=__weak:137:9
+// CHECK-WITH-WEAK: Identifier: "Foo" [141:10 - 141:13] ObjCClassRef=Foo:1:12
+// CHECK-WITH-WEAK: Punctuation: "*" [141:14 - 141:15] ObjCIvarDecl=foo:141:15 (Definition)
+// CHECK-WITH-WEAK: Identifier: "foo" [141:15 - 141:18] ObjCIvarDecl=foo:141:15 (Definition)
+// CHECK-WITH-WEAK: Punctuation: ";" [141:18 - 141:19] ObjCInterfaceDecl=rdar9535717:140:12
+// CHECK-WITH-WEAK: Punctuation: "}" [142:1 - 142:2] ObjCInterfaceDecl=rdar9535717:140:12

Modified: cfe/trunk/test/Index/get-cursor.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/get-cursor.m?rev=137634&r1=137633&r2=137634&view=diff
==============================================================================
--- cfe/trunk/test/Index/get-cursor.m (original)
+++ cfe/trunk/test/Index/get-cursor.m Mon Aug 15 13:44:43 2011
@@ -5,7 +5,17 @@
 @property (readwrite) int foo2;
 @end
 
+ at class Foo;
+
+ at interface rdar9535717 {
+  __weak Foo *foo;
+}
+ at end
+
 // RUN: c-index-test -cursor-at=%s:4:28 %s | FileCheck -check-prefix=CHECK-PROP1 %s
 // RUN: c-index-test -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP2 %s
 // CHECK-PROP1: ObjCPropertyDecl=foo1:4:26
 // CHECK-PROP2: ObjCPropertyDecl=foo2:5:27
+
+// RUN: c-index-test -cursor-at=%s:11:11 %s | FileCheck -check-prefix=CHECK-WITH-WEAK %s
+// CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=137634&r1=137633&r2=137634&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Aug 15 13:44:43 2011
@@ -348,6 +348,7 @@
   bool VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL);
   bool VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL);
   bool VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL);
+  bool VisitAttributedTypeLoc(AttributedTypeLoc TL);
   bool VisitFunctionTypeLoc(FunctionTypeLoc TL, bool SkipResultType = false);
   bool VisitArrayTypeLoc(ArrayTypeLoc TL);
   bool VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL);
@@ -1521,6 +1522,10 @@
   return Visit(TL.getPointeeLoc());
 }
 
+bool CursorVisitor::VisitAttributedTypeLoc(AttributedTypeLoc TL) {
+  return Visit(TL.getModifiedLoc());
+}
+
 bool CursorVisitor::VisitFunctionTypeLoc(FunctionTypeLoc TL, 
                                          bool SkipResultType) {
   if (!SkipResultType && Visit(TL.getResultLoc()))





More information about the cfe-commits mailing list