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