get-cursor.m revision ba1da14e79c1ecd49306e5175b69baa1e7ed4293
1// Test is line- and column-sensitive. Run lines are below.
2
3@interface rdar9771715
4@property (readonly) int foo1;
5@property (readwrite) int foo2;
6@end
7
8@class Foo;
9
10@interface rdar9535717 {
11  __weak Foo *foo;
12}
13@end
14
15@interface Test1 {
16  id _name;
17}
18@end
19@interface Test1 ()
20- (id)name;
21@end
22@interface Test1 ()
23@property (copy) id name;
24@end
25@implementation Test1
26@synthesize name = _name;
27@end
28
29@interface rdar10902015
30@end
31
32@implementation rdar10902015
33
34struct S { int x; };
35
36-(void)mm:(struct S*)s {
37  rdar10902015 *i = 0;
38  s->x = 0;
39  Test1 *test1;
40  test1.name = 0;
41}
42@end
43
44@interface Test2
45-(int)implicitProp;
46-(void)setImplicitProp:(int)x;
47@end
48
49void foo1(Test2 *test2) {
50  int x = test2.implicitProp;
51  test2.implicitProp = x;
52  ++test2.implicitProp;
53}
54
55@interface Test3
56-(void)setFoo:(int)x withBar:(int)y;
57@end
58
59void foo3(Test3 *test3) {
60  [test3 setFoo:2 withBar:4];
61}
62
63// RUN: c-index-test -cursor-at=%s:4:28 -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP %s
64// CHECK-PROP: ObjCPropertyDecl=foo1:4:26
65// CHECK-PROP: ObjCPropertyDecl=foo2:5:27
66
67// RUN: c-index-test -cursor-at=%s:11:11 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s
68// CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8
69
70// RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s
71// CHECK-METHOD: 20:7 ObjCInstanceMethodDecl=name:20:7 Extent=[20:1 - 20:12]
72
73// RUN: c-index-test -cursor-at=%s:37:17 %s | FileCheck -check-prefix=CHECK-IN-IMPL %s
74// CHECK-IN-IMPL: VarDecl=i:37:17
75
76// RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 \
77// RUN:   -cursor-at=%s:50:20 -cursor-at=%s:51:15 -cursor-at=%s:52:20 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s
78// CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7]
79// CHECK-MEMBERREF: 40:9 MemberRefExpr=name:23:21 Extent=[40:3 - 40:13] Spelling=name ([40:9 - 40:13])
80// CHECK-MEMBERREF: 50:17 MemberRefExpr=implicitProp:45:7 Extent=[50:11 - 50:29] Spelling=implicitProp ([50:17 - 50:29])
81// CHECK-MEMBERREF: 51:9 MemberRefExpr=setImplicitProp::46:8 Extent=[51:3 - 51:21] Spelling=setImplicitProp: ([51:9 - 51:21])
82// CHECK-MEMBERREF: 52:11 MemberRefExpr=setImplicitProp::46:8 Extent=[52:5 - 52:23] Spelling=setImplicitProp: ([52:11 - 52:23])
83
84// RUN: c-index-test -cursor-at=%s:56:24 -cursor-at=%s:60:14 \
85// RUN:   %s | FileCheck -check-prefix=CHECK-SPELLRANGE %s
86// CHECK-SPELLRANGE: 56:8 ObjCInstanceMethodDecl=setFoo:withBar::56:8 Extent=[56:1 - 56:37] Spelling=setFoo:withBar: ([56:8 - 56:14][56:22 - 56:29])
87// CHECK-SPELLRANGE: 60:3 ObjCMessageExpr=setFoo:withBar::56:8 Extent=[60:3 - 60:29] Spelling=setFoo:withBar: ([60:10 - 60:16][60:19 - 60:26])
88