xref: /minix3/external/bsd/llvm/dist/clang/test/Index/TestClassDecl.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: c-index-test -write-pch %t.ast -fobjc-nonfragile-abi -fblocks -x objective-c %s
2*f4a2713aSLionel Sambuc// RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=CHECK-scan %s
3*f4a2713aSLionel Sambuc// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=CHECK-load %s
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc// This test checks how the @class resolves as a cursor when there is a real definition
6*f4a2713aSLionel Sambuc// that follows. <rdar://problem/7383421>
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@class Foo;
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface Foo
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambucvoid function(Foo * arg)
14*f4a2713aSLionel Sambuc{
15*f4a2713aSLionel Sambuc    // nothing here.
16*f4a2713aSLionel Sambuc}
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound
19*f4a2713aSLionel Sambuc// CHECK-scan: [8:1 - 8:8] ObjCInterfaceDecl=Foo:8:8
20*f4a2713aSLionel Sambuc// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:10:12
21*f4a2713aSLionel Sambuc// CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound
22*f4a2713aSLionel Sambuc// CHECK-scan: [10:1 - 11:5] ObjCInterfaceDecl=Foo:10:12
23*f4a2713aSLionel Sambuc// CHECK-scan: [11:5 - 13:1] Invalid Cursor => NoDeclFound
24*f4a2713aSLionel Sambuc// CHECK-scan: [13:1 - 13:15] FunctionDecl=function:13:6 (Definition)
25*f4a2713aSLionel Sambuc// CHECK-scan: [13:15 - 13:18] ObjCClassRef=Foo:10:12
26*f4a2713aSLionel Sambuc// CHECK-scan: [13:18 - 13:24] ParmDecl=arg:13:21 (Definition)
27*f4a2713aSLionel Sambuc// CHECK-scan: [13:24 - 14:1] FunctionDecl=function:13:6 (Definition)
28*f4a2713aSLionel Sambuc// CHECK-scan: [14:1 - 16:2] CompoundStmt=
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc// CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:5]
31*f4a2713aSLionel Sambuc// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:1 - 16:2]
32*f4a2713aSLionel Sambuc// CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 (Definition) Extent=[13:15 - 13:24]
33*f4a2713aSLionel Sambuc
34