summaryrefslogtreecommitdiffstats
path: root/test/Index/c-index-getCursor-test.m
blob: 23ae21887830240b79c02004ff1dbec234b1013a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// RUN: %clang_cc1 -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 %s
@interface Foo 
{
}

- foo;
+ fooC;

@end

@interface Bar : Foo 
{
}

@end

@interface Foo (FooCat)
- (int) catMethodWithFloat:(float) fArg;
- (float) floatMethod;
@end

@protocol Proto
- pMethod;
@end

@protocol SubP <Proto>
- spMethod;
@end

@interface Baz : Bar <SubP>
{
    int _anIVar;
}

- (Foo *) bazMethod;

@end

enum {
  someEnum
};

int main (int argc, const char * argv[]) {
	Baz * bee;
	id a = [bee foo];
	id <SubP> c = [Foo fooC];
	id <Proto> d;
	d = c;
	[d pMethod];
	[bee catMethodWithFloat:[bee floatMethod]];
  main(someEnum, (const char **)bee);
}

// CHECK: {start_line=1 start_col=1 end_line=2 end_col=62} Invalid Cursor => NoDeclFound
// CHECK: {start_line=3 start_col=1 end_line=6 end_col=1} ObjCInterfaceDecl=Foo:3:1
// CHECK: {start_line=7 start_col=1 end_line=7 end_col=6} ObjCInstanceMethodDecl=foo:7:1
// CHECK: {start_line=7 start_col=7 end_line=7 end_col=7} ObjCInterfaceDecl=Foo:3:1
// CHECK: {start_line=8 start_col=1 end_line=8 end_col=7} ObjCClassMethodDecl=fooC:8:1
// CHECK: {start_line=8 start_col=8 end_line=10 end_col=1} ObjCInterfaceDecl=Foo:3:1
// CHECK: {start_line=10 start_col=2 end_line=11 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=12 start_col=1 end_line=16 end_col=1} ObjCInterfaceDecl=Bar:12:1
// CHECK: {start_line=16 start_col=2 end_line=17 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=18 start_col=1 end_line=18 end_col=24} ObjCCategoryDecl=FooCat:18:1
// CHECK: {start_line=19 start_col=1 end_line=19 end_col=28} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
// CHECK: {start_line=19 start_col=29 end_line=19 end_col=33} ParmDecl=fArg:19:36
// CHECK: {start_line=19 start_col=34 end_line=19 end_col=35} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
// CHECK: {start_line=19 start_col=36 end_line=19 end_col=39} ParmDecl=fArg:19:36
// CHECK: {start_line=19 start_col=40 end_line=19 end_col=40} ObjCInstanceMethodDecl=catMethodWithFloat::19:1
// CHECK: {start_line=19 start_col=41 end_line=19 end_col=41} ObjCCategoryDecl=FooCat:18:1
// CHECK: {start_line=20 start_col=1 end_line=20 end_col=22} ObjCInstanceMethodDecl=floatMethod:20:1
// CHECK: {start_line=20 start_col=23 end_line=21 end_col=1} ObjCCategoryDecl=FooCat:18:1
// CHECK: {start_line=21 start_col=2 end_line=22 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=23 start_col=1 end_line=23 end_col=16} ObjCProtocolDecl=Proto:23:1
// CHECK: {start_line=24 start_col=1 end_line=24 end_col=10} ObjCInstanceMethodDecl=pMethod:24:1
// CHECK: {start_line=24 start_col=11 end_line=25 end_col=1} ObjCProtocolDecl=Proto:23:1
// CHECK: {start_line=25 start_col=2 end_line=26 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=27 start_col=1 end_line=27 end_col=23} ObjCProtocolDecl=SubP:27:1
// CHECK: {start_line=28 start_col=1 end_line=28 end_col=11} ObjCInstanceMethodDecl=spMethod:28:1
// CHECK: {start_line=28 start_col=12 end_line=29 end_col=1} ObjCProtocolDecl=SubP:27:1
// CHECK: {start_line=29 start_col=2 end_line=30 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=31 start_col=1 end_line=33 end_col=4} ObjCInterfaceDecl=Baz:31:1
// CHECK: {start_line=33 start_col=5 end_line=33 end_col=7} Invalid Cursor => NotImplemented
// CHECK: {start_line=33 start_col=8 end_line=33 end_col=8} ObjCInterfaceDecl=Baz:31:1
// CHECK: {start_line=33 start_col=9 end_line=33 end_col=15} Invalid Cursor => NotImplemented
// CHECK: {start_line=33 start_col=16 end_line=35 end_col=1} ObjCInterfaceDecl=Baz:31:1
// CHECK: {start_line=36 start_col=1 end_line=36 end_col=20} ObjCInstanceMethodDecl=bazMethod:36:1
// CHECK: {start_line=36 start_col=21 end_line=38 end_col=1} ObjCInterfaceDecl=Baz:31:1
// CHECK: {start_line=38 start_col=2 end_line=39 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=40 start_col=1 end_line=41 end_col=2} EnumDecl=:40:1
// CHECK: {start_line=41 start_col=3 end_line=41 end_col=10} EnumConstantDecl=someEnum:41:3
// CHECK: {start_line=41 start_col=11 end_line=42 end_col=1} EnumDecl=:40:1
// CHECK: {start_line=42 start_col=2 end_line=43 end_col=1} Invalid Cursor => NoDeclFound
// CHECK: {start_line=44 start_col=1 end_line=44 end_col=3} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=4 end_line=44 end_col=4} Invalid Cursor => NoDeclFound
// CHECK: {start_line=44 start_col=5 end_line=44 end_col=10} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=11 end_line=44 end_col=13} ParmDecl=argc:44:15
// CHECK: {start_line=44 start_col=14 end_line=44 end_col=14} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=15 end_line=44 end_col=18} ParmDecl=argc:44:15
// CHECK: {start_line=44 start_col=19 end_line=44 end_col=26} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=27 end_line=44 end_col=30} ParmDecl=argv:44:34
// CHECK: {start_line=44 start_col=31 end_line=44 end_col=31} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=32 end_line=44 end_col=32} ParmDecl=argv:44:34
// CHECK: {start_line=44 start_col=33 end_line=44 end_col=33} FunctionDecl=main:44:5
// CHECK: {start_line=44 start_col=34 end_line=44 end_col=39} ParmDecl=argv:44:34
// CHECK: {start_line=44 start_col=40 end_line=45 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=45 start_col=2 end_line=45 end_col=4} ObjCClassRef=Baz:45:8
// CHECK: {start_line=45 start_col=5 end_line=45 end_col=5} FunctionDecl=main:44:5
// CHECK: {start_line=45 start_col=6 end_line=45 end_col=6} VarDecl=bee:45:8
// CHECK: {start_line=45 start_col=7 end_line=45 end_col=7} FunctionDecl=main:44:5
// CHECK: {start_line=45 start_col=8 end_line=45 end_col=10} VarDecl=bee:45:8
// CHECK: {start_line=45 start_col=11 end_line=46 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=46 start_col=2 end_line=46 end_col=3} TypedefDecl=id:0:0
// CHECK: {start_line=46 start_col=4 end_line=46 end_col=4} FunctionDecl=main:44:5
// CHECK: {start_line=46 start_col=5 end_line=46 end_col=8} VarDecl=a:46:5
// CHECK: {start_line=46 start_col=9 end_line=46 end_col=9} ObjCSelectorRef=foo:7:1
// CHECK: {start_line=46 start_col=10 end_line=46 end_col=12} VarRef=bee:45:8
// CHECK: {start_line=46 start_col=13 end_line=46 end_col=17} ObjCSelectorRef=foo:7:1
// CHECK: {start_line=46 start_col=18 end_line=47 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=47 start_col=2 end_line=47 end_col=3} TypedefDecl=id:0:0
// CHECK: {start_line=47 start_col=4 end_line=47 end_col=4} FunctionDecl=main:44:5
// CHECK: {start_line=47 start_col=5 end_line=47 end_col=5} VarDecl=c:47:12
// CHECK: {start_line=47 start_col=6 end_line=47 end_col=9} ObjCProtocolRef=SubP:47:12
// CHECK: {start_line=47 start_col=10 end_line=47 end_col=10} VarDecl=c:47:12
// CHECK: {start_line=47 start_col=11 end_line=47 end_col=11} FunctionDecl=main:44:5
// CHECK: {start_line=47 start_col=12 end_line=47 end_col=15} VarDecl=c:47:12
// CHECK: {start_line=47 start_col=16 end_line=47 end_col=25} ObjCSelectorRef=fooC:8:1
// CHECK: {start_line=47 start_col=26 end_line=48 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=48 start_col=2 end_line=48 end_col=3} TypedefDecl=id:0:0
// CHECK: {start_line=48 start_col=4 end_line=48 end_col=4} FunctionDecl=main:44:5
// CHECK: {start_line=48 start_col=5 end_line=48 end_col=5} VarDecl=d:48:13
// CHECK: {start_line=48 start_col=6 end_line=48 end_col=10} ObjCProtocolRef=Proto:48:13
// CHECK: {start_line=48 start_col=11 end_line=48 end_col=11} VarDecl=d:48:13
// CHECK: {start_line=48 start_col=12 end_line=48 end_col=12} FunctionDecl=main:44:5
// CHECK: {start_line=48 start_col=13 end_line=48 end_col=13} VarDecl=d:48:13
// CHECK: {start_line=48 start_col=14 end_line=49 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=49 start_col=2 end_line=49 end_col=2} VarRef=d:48:13
// CHECK: {start_line=49 start_col=3 end_line=49 end_col=5} FunctionDecl=main:44:5
// CHECK: {start_line=49 start_col=6 end_line=49 end_col=6} VarRef=c:47:12
// CHECK: {start_line=49 start_col=7 end_line=50 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=50 start_col=2 end_line=50 end_col=2} ObjCSelectorRef=pMethod:24:1
// CHECK: {start_line=50 start_col=3 end_line=50 end_col=3} VarRef=d:48:13
// CHECK: {start_line=50 start_col=4 end_line=50 end_col=12} ObjCSelectorRef=pMethod:24:1
// CHECK: {start_line=50 start_col=13 end_line=51 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=51 start_col=2 end_line=51 end_col=2} ObjCSelectorRef=catMethodWithFloat::19:1
// CHECK: {start_line=51 start_col=3 end_line=51 end_col=5} VarRef=bee:45:8
// CHECK: {start_line=51 start_col=6 end_line=51 end_col=25} ObjCSelectorRef=catMethodWithFloat::19:1
// CHECK: {start_line=51 start_col=26 end_line=51 end_col=26} ObjCSelectorRef=floatMethod:20:1
// CHECK: {start_line=51 start_col=27 end_line=51 end_col=29} VarRef=bee:45:8
// CHECK: {start_line=51 start_col=30 end_line=51 end_col=42} ObjCSelectorRef=floatMethod:20:1
// CHECK: {start_line=51 start_col=43 end_line=51 end_col=43} ObjCSelectorRef=catMethodWithFloat::19:1
// CHECK: {start_line=51 start_col=44 end_line=52 end_col=2} FunctionDecl=main:44:5
// CHECK: {start_line=52 start_col=3 end_line=52 end_col=6} FunctionRef=main:44:5
// CHECK: {start_line=52 start_col=7 end_line=52 end_col=7} FunctionDecl=main:44:5
// CHECK: {start_line=52 start_col=8 end_line=52 end_col=15} EnumConstantRef=someEnum:41:3
// CHECK: {start_line=52 start_col=16 end_line=52 end_col=32} FunctionDecl=main:44:5
// CHECK: {start_line=52 start_col=33 end_line=52 end_col=35} VarRef=bee:45:8
// CHECK: {start_line=52 start_col=36 end_line=53 end_col=1} FunctionDecl=main:44:5
// CHECK: {start_line=53 start_col=2 end_line=160 end_col=1} Invalid Cursor => NoDeclFound