summaryrefslogtreecommitdiffstats
path: root/test/Index/TestClassForwardDecl.m
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-11-18 02:02:52 +0000
committerTed Kremenek <kremenek@apple.com>2009-11-18 02:02:52 +0000
commit1d5fdf3d3b5ea2640ebe8673814a0b6ab7cf5eb2 (patch)
tree446e905eb89ba6af210853729e519756b66be4d6 /test/Index/TestClassForwardDecl.m
parent95ac6556a5dfc504491103c37f9aa05b303d2729 (diff)
Add special clang_getCursor() support for @class. Handles <rdar://problem/7383421>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/TestClassForwardDecl.m')
-rw-r--r--test/Index/TestClassForwardDecl.m46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
new file mode 100644
index 0000000000..4584445d0b
--- /dev/null
+++ b/test/Index/TestClassForwardDecl.m
@@ -0,0 +1,46 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s
+// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s
+
+// This test checks how the @class resolves as a cursor when the @interface is implicitly defined.
+// See TestClassDecl.m for the corresponding test case. (<rdar://problem/7383421>)
+
+@class Foo;
+
+void function(Foo * arg)
+{
+ // nothing here.
+}
+
+// CHECK-scan: {start_line=1 start_col=1 end_line=7 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=8 start_col=1 end_line=8 end_col=7} Invalid Cursor => NotImplemented
+// CHECK-scan: {start_line=8 start_col=8 end_line=8 end_col=10} ObjCClassRef=Foo:8:1
+// CHECK-scan: {start_line=8 start_col=11 end_line=9 end_col=1} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=10 start_col=1 end_line=10 end_col=4} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=5 end_line=10 end_col=5} Invalid Cursor => NoDeclFound
+// CHECK-scan: {start_line=10 start_col=6 end_line=10 end_col=14} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=15 end_line=10 end_col=17} ObjCClassRef=Foo:10:21
+// CHECK-scan: {start_line=10 start_col=18 end_line=10 end_col=18} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=19 end_line=10 end_col=19} ParmDecl=arg:10:21
+// CHECK-scan: {start_line=10 start_col=20 end_line=10 end_col=20} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=10 start_col=21 end_line=10 end_col=23} ParmDecl=arg:10:21
+// CHECK-scan: {start_line=10 start_col=24 end_line=13 end_col=1} FunctionDecl=function:10:6
+// CHECK-scan: {start_line=13 start_col=2 end_line=46 end_col=1} Invalid Cursor => NoDeclFound
+
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag]
+// CHECK-load: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=TestClassForwardDecl.m]
+// CHECK-load: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=TestClassForwardDecl.m]
+// CHECK-load: TestClassForwardDecl.m:10:6: FunctionDefn=function [Context=TestClassForwardDecl.m]
+// CHECK-load: TestClassForwardDecl.m:10:21: ParmDecl=arg:10:21 [Context=function]
+