[cfe-commits] r132603 - in /cfe/trunk: 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
Douglas Gregor
dgregor at apple.com
Fri Jun 3 16:08:58 PDT 2011
Author: dgregor
Date: Fri Jun 3 18:08:58 2011
New Revision: 132603
URL: http://llvm.org/viewvc/llvm-project?rev=132603&view=rev
Log:
Expose @synthesize and @dynamic via their own cursor kinds in
libclang. Fixes <rdar://problem/9537904>.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/annotate-tokens.m
cfe/trunk/test/Index/properties-class-extensions.m
cfe/trunk/test/Index/usrs.m
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Jun 3 18:08:58 2011
@@ -1187,8 +1187,12 @@
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 */
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jun 3 18:08:58 2011
@@ -2658,6 +2658,16 @@
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()) {
Modified: cfe/trunk/test/Index/annotate-tokens.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-tokens.m?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-tokens.m (original)
+++ cfe/trunk/test/Index/annotate-tokens.m Fri Jun 3 18:08:58 2011
@@ -500,10 +500,10 @@
// 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)
Modified: cfe/trunk/test/Index/properties-class-extensions.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/properties-class-extensions.m?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/test/Index/properties-class-extensions.m (original)
+++ cfe/trunk/test/Index/properties-class-extensions.m Fri Jun 3 18:08:58 2011
@@ -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]
Modified: cfe/trunk/test/Index/usrs.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/usrs.m?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/test/Index/usrs.m (original)
+++ cfe/trunk/test/Index/usrs.m Fri Jun 3 18:08:58 2011
@@ -195,7 +195,7 @@
// 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]
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=132603&r1=132602&r2=132603&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Jun 3 18:08:58 2011
@@ -3381,7 +3381,11 @@
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");
More information about the cfe-commits
mailing list