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