]> granicus.if.org Git - clang/commitdiff
Expose @synthesize and @dynamic via their own cursor kinds in
authorDouglas Gregor <dgregor@apple.com>
Fri, 3 Jun 2011 23:08:58 +0000 (23:08 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 3 Jun 2011 23:08:58 +0000 (23:08 +0000)
libclang. Fixes <rdar://problem/9537904>.

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

include/clang-c/Index.h
lib/Sema/SemaCodeComplete.cpp
test/Index/annotate-tokens.m
test/Index/properties-class-extensions.m
test/Index/usrs.m
tools/libclang/CIndex.cpp

index c79475eff407c9ade13957923f1db1c053309334..cb0b3c1babcb2d4a1369ce0422eabb466737867e 100644 (file)
@@ -1187,8 +1187,12 @@ enum CXCursorKind {
   CXCursor_UsingDeclaration              = 35,
   /** \brief A C++ alias declaration */
   CXCursor_TypeAliasDecl                 = 36,
+  /** \brief An Objective-C @synthesize definition. */
+  CXCursor_ObjCSynthesizeDecl            = 37,
+  /** \brief An Objective-C @dynamic definition. */
+  CXCursor_ObjCDynamicDecl               = 38,
   CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
-  CXCursor_LastDecl                      = CXCursor_TypeAliasDecl,
+  CXCursor_LastDecl                      = CXCursor_ObjCDynamicDecl,
 
   /* References */
   CXCursor_FirstRef                      = 40, /* Decl references */
index 294c7934f8d3cfb00776d947a5072cb6e7254c8a..0b6cf87de5c3f557035bdfda9cb4d103d5527d73 100644 (file)
@@ -2658,6 +2658,16 @@ CXCursorKind clang::getCursorKindForDecl(Decl *D) {
     case Decl::UnresolvedUsingTypename: 
       return CXCursor_UsingDeclaration;
       
+    case Decl::ObjCPropertyImpl:
+      switch (cast<ObjCPropertyImplDecl>(D)->getPropertyImplementation()) {
+      case ObjCPropertyImplDecl::Dynamic:
+        return CXCursor_ObjCDynamicDecl;
+          
+      case ObjCPropertyImplDecl::Synthesize:
+        return CXCursor_ObjCSynthesizeDecl;
+      }
+      break;
+      
     default:
       if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
         switch (TD->getTagKind()) {
index f977e5c3dfe8af62e8b27e067b5c8f8c72f64556..1eb77940da2ef5d9b507106b6134161fc25d50b9 100644 (file)
@@ -500,10 +500,10 @@ static Rdar8595462_A * Rdar8595462_staticVar;
 // CHECK: Punctuation: "*" [111:26 - 111:27] ObjCPropertyDecl=foo2:111:27
 // CHECK: Identifier: "foo2" [111:27 - 111:31] ObjCPropertyDecl=foo2:111:27
 
-// CHECK: Punctuation: "@" [115:1 - 115:2] UnexposedDecl=foo:110:33 (Definition)
-// CHECK: Keyword: "synthesize" [115:2 - 115:12] UnexposedDecl=foo:110:33 (Definition)
-// CHECK: Identifier: "foo" [115:13 - 115:16] UnexposedDecl=foo:110:33 (Definition)
-// CHECK: Punctuation: "=" [115:17 - 115:18] UnexposedDecl=foo:110:33 (Definition)
+// CHECK: Punctuation: "@" [115:1 - 115:2] ObjCSynthesizeDecl=foo:110:33 (Definition)
+// CHECK: Keyword: "synthesize" [115:2 - 115:12] ObjCSynthesizeDecl=foo:110:33 (Definition)
+// CHECK: Identifier: "foo" [115:13 - 115:16] ObjCSynthesizeDecl=foo:110:33 (Definition)
+// CHECK: Punctuation: "=" [115:17 - 115:18] ObjCSynthesizeDecl=foo:110:33 (Definition)
 // CHECK: Identifier: "_foo" [115:19 - 115:23] MemberRef=_foo:107:8
 // CHECK: Punctuation: ";" [115:23 - 115:24] ObjCImplementationDecl=Rdar8595386:114:1 (Definition)
 
index ecedc60c821dd4f00f9aca60df3280ee25a7c925..de612425c270c2dd89307999df7275662c06669e 100644 (file)
@@ -95,5 +95,5 @@
 // CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=qux:38:34 Extent=[38:34 - 38:37]
 // CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=setQux::38:34 Extent=[38:34 - 38:37]
 // CHECK: properties-class-extensions.m:38:34: ParmDecl=qux:38:34 (Definition) Extent=[38:34 - 38:37]
-// CHECK: properties-class-extensions.m:42:10: UnexposedDecl=qux:38:34 (Definition) Extent=[42:1 - 42:13]
+// CHECK: properties-class-extensions.m:42:10: ObjCDynamicDecl=qux:38:34 (Definition) Extent=[42:1 - 42:13]
 
index 4b79fdcbba8d9329b9f145b68620ff3b984afbea..2830647019184ef2a317c85a91c840c36ad7bea1 100644 (file)
@@ -195,7 +195,7 @@ int test_multi_declaration(void) {
 // CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11]
 // CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11]
 // CHECK-source: usrs.m:44:13: ObjCIvarDecl=d1:44:13 (Definition) Extent=[44:13 - 44:15]
-// CHECK-source: usrs.m:44:13: UnexposedDecl=d1:31:15 (Definition) Extent=[44:1 - 44:15]
+// CHECK-source: usrs.m:44:13: ObjCSynthesizeDecl=d1:31:15 (Definition) Extent=[44:1 - 44:15]
 // CHECK-source: usrs.m:47:5: VarDecl=z:47:5 Extent=[47:1 - 47:6]
 // CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:1 - 49:43]
 // CHECK-source: usrs.m:49:27: ParmDecl=x:49:27 (Definition) Extent=[49:23 - 49:28]
index 7348491072f505d5fbeb7edc87d97ab60fe8b4df..2a9d96db4c35cb81b95f4c31379693556c2b3a2e 100644 (file)
@@ -3381,7 +3381,11 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
   case CXCursor_UsingDeclaration:
     return createCXString("UsingDeclaration");
   case CXCursor_TypeAliasDecl:
-      return createCXString("TypeAliasDecl");
+    return createCXString("TypeAliasDecl");
+  case CXCursor_ObjCSynthesizeDecl:
+    return createCXString("ObjCSynthesizeDecl");
+  case CXCursor_ObjCDynamicDecl:
+    return createCXString("ObjCDynamicDecl");
   }
 
   llvm_unreachable("Unhandled CXCursorKind");