]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Index/file-refs.m
Vendor import of clang release_30 branch r142614:
[FreeBSD/FreeBSD.git] / test / Index / file-refs.m
1 @class Foo;
2
3 @interface Foo
4 -(id)setWithInt:(int)i andFloat:(float)f;
5 @end
6
7 @implementation Foo
8 -(id)setWithInt:(int)i andFloat:(float)f {
9   return self;
10 }
11 @end
12
13 void test(Foo *foo) {
14   [foo setWithInt:0 andFloat:0];
15   [foo setWithInt: 2 andFloat: 3];
16 }
17
18 @protocol Prot1
19 -(void)protMeth;
20 @end
21
22 @protocol Prot2<Prot1>
23 @end
24
25 @interface Base<Prot2>
26 @end
27
28 @interface Sub : Base
29 -(void)protMeth;
30 @end
31
32 @implementation Sub
33 -(void)protMeth {}
34 @end
35
36 void test2(Sub *s, id<Prot1> p) {
37   [s protMeth];
38   [p protMeth];
39 }
40
41
42 // RUN: c-index-test \
43
44 // RUN:  -file-refs-at=%s:7:18 \
45 // CHECK:      ObjCImplementationDecl=Foo:7:17 (Definition)
46 // CHECK-NEXT: ObjCClassRef=Foo:3:12 =[1:8 - 1:11]
47 // CHECK-NEXT: ObjCInterfaceDecl=Foo:3:12 =[3:12 - 3:15]
48 // CHECK-NEXT: ObjCImplementationDecl=Foo:7:17 (Definition) =[7:17 - 7:20]
49 // CHECK-NEXT: ObjCClassRef=Foo:3:12 =[13:11 - 13:14]
50
51 // RUN:  -file-refs-at=%s:4:10 \
52 // CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1
53 // CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:6 - 4:16]
54 // CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:6 - 8:16]
55 // CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:8 - 14:18]
56 // CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:8 - 15:18]
57
58 // RUN:  -file-refs-at=%s:15:27 \
59 // CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1
60 // CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:24 - 4:32]
61 // CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:24 - 8:32]
62 // CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:21 - 14:29]
63 // CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:22 - 15:30]
64
65 // RUN:  -file-refs-at=%s:18:13 \
66 // CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition)
67 // CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition) =[18:11 - 18:16]
68 // CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[22:17 - 22:22]
69 // CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[36:23 - 36:28]
70
71 // RUN:  -file-refs-at=%s:38:10 \
72 // CHECK-NEXT: ObjCMessageExpr=protMeth:19:1
73 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16]
74 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16]
75 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16]
76 // CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14]
77 // CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14]
78
79 // RUN:  -file-refs-at=%s:33:12 \
80 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1]
81 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16]
82 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16]
83 // CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16]
84 // CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14]
85 // CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14]
86
87 // RUN:   %s | FileCheck %s