Argyrios Kyrtzidis | 8a4bfaa | 2011-08-10 21:12:04 +0000 | [diff] [blame] | 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 | |
Argyrios Kyrtzidis | 3422fbc | 2011-08-15 18:44:43 +0000 | [diff] [blame] | 8 | @class Foo; |
| 9 | |
| 10 | @interface rdar9535717 { |
| 11 | __weak Foo *foo; |
| 12 | } |
| 13 | @end |
| 14 | |
Argyrios Kyrtzidis | 75cf3e8 | 2011-08-17 19:25:08 +0000 | [diff] [blame] | 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 | |
Argyrios Kyrtzidis | 644af7b | 2012-02-23 21:11:20 +0000 | [diff] [blame] | 29 | @interface rdar10902015 |
| 30 | @end |
| 31 | |
| 32 | @implementation rdar10902015 |
| 33 | |
Argyrios Kyrtzidis | 66373dd | 2012-03-30 00:19:05 +0000 | [diff] [blame] | 34 | struct S { int x; }; |
Argyrios Kyrtzidis | 644af7b | 2012-02-23 21:11:20 +0000 | [diff] [blame] | 35 | |
| 36 | -(void)mm:(struct S*)s { |
| 37 | rdar10902015 *i = 0; |
Argyrios Kyrtzidis | 66373dd | 2012-03-30 00:19:05 +0000 | [diff] [blame] | 38 | s->x = 0; |
Argyrios Kyrtzidis | d046952 | 2012-03-30 00:19:13 +0000 | [diff] [blame] | 39 | Test1 *test1; |
| 40 | test1.name = 0; |
Argyrios Kyrtzidis | 644af7b | 2012-02-23 21:11:20 +0000 | [diff] [blame] | 41 | } |
| 42 | @end |
| 43 | |
Argyrios Kyrtzidis | b085d89 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 44 | @interface Test2 |
| 45 | -(int)implicitProp; |
| 46 | -(void)setImplicitProp:(int)x; |
| 47 | @end |
| 48 | |
| 49 | void foo1(Test2 *test2) { |
| 50 | int x = test2.implicitProp; |
| 51 | test2.implicitProp = x; |
| 52 | ++test2.implicitProp; |
| 53 | } |
| 54 | |
Argyrios Kyrtzidis | ba1da14 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 55 | @interface Test3 |
| 56 | -(void)setFoo:(int)x withBar:(int)y; |
| 57 | @end |
| 58 | |
| 59 | void foo3(Test3 *test3) { |
| 60 | [test3 setFoo:2 withBar:4]; |
| 61 | } |
| 62 | |
Argyrios Kyrtzidis | 9482a18 | 2012-04-16 20:01:28 +0000 | [diff] [blame] | 63 | @interface Test4 |
| 64 | @end |
| 65 | @interface Test4(Dido) |
| 66 | @end |
| 67 | @implementation Test4(Dido) |
| 68 | @end |
| 69 | |
Argyrios Kyrtzidis | a9d45a3 | 2012-04-16 22:42:01 +0000 | [diff] [blame] | 70 | @class Forw1, Forw2, Forw3; |
| 71 | |
Argyrios Kyrtzidis | 135bf8e | 2012-06-09 03:03:02 +0000 | [diff] [blame] | 72 | @interface Test5 { |
| 73 | id prop1; |
| 74 | id prop2; |
| 75 | } |
| 76 | @property (assign) id prop1; |
| 77 | @property (assign) id prop2; |
| 78 | @property (assign) id prop3; |
| 79 | @property (assign) id prop4; |
| 80 | @end |
| 81 | |
| 82 | @implementation Test5 |
| 83 | @synthesize prop1, prop2; |
| 84 | @dynamic prop3, prop4; |
Argyrios Kyrtzidis | a0cff72 | 2012-06-16 00:46:02 +0000 | [diff] [blame] | 85 | |
| 86 | -(id)meth1 { |
| 87 | return 0; |
| 88 | } |
| 89 | -(id)meth2{ |
| 90 | return 0; |
| 91 | } |
Argyrios Kyrtzidis | 135bf8e | 2012-06-09 03:03:02 +0000 | [diff] [blame] | 92 | @end |
| 93 | |
Argyrios Kyrtzidis | c178d76 | 2012-08-28 00:04:23 +0000 | [diff] [blame] | 94 | @interface Test6 |
| 95 | @property (assign) id prop1; |
| 96 | @end |
| 97 | |
| 98 | @implementation Test6 |
| 99 | @synthesize prop1 = _prop1; |
| 100 | @end |
| 101 | |
Argyrios Kyrtzidis | 75cf3e8 | 2011-08-17 19:25:08 +0000 | [diff] [blame] | 102 | // RUN: c-index-test -cursor-at=%s:4:28 -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP %s |
| 103 | // CHECK-PROP: ObjCPropertyDecl=foo1:4:26 |
| 104 | // CHECK-PROP: ObjCPropertyDecl=foo2:5:27 |
Argyrios Kyrtzidis | 3422fbc | 2011-08-15 18:44:43 +0000 | [diff] [blame] | 105 | |
Sebastian Pop | 9ec60df | 2012-01-20 22:01:23 +0000 | [diff] [blame] | 106 | // RUN: c-index-test -cursor-at=%s:11:11 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s |
Argyrios Kyrtzidis | 3422fbc | 2011-08-15 18:44:43 +0000 | [diff] [blame] | 107 | // CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8 |
Argyrios Kyrtzidis | 75cf3e8 | 2011-08-17 19:25:08 +0000 | [diff] [blame] | 108 | |
| 109 | // RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s |
Argyrios Kyrtzidis | 66373dd | 2012-03-30 00:19:05 +0000 | [diff] [blame] | 110 | // CHECK-METHOD: 20:7 ObjCInstanceMethodDecl=name:20:7 Extent=[20:1 - 20:12] |
Argyrios Kyrtzidis | 644af7b | 2012-02-23 21:11:20 +0000 | [diff] [blame] | 111 | |
| 112 | // RUN: c-index-test -cursor-at=%s:37:17 %s | FileCheck -check-prefix=CHECK-IN-IMPL %s |
| 113 | // CHECK-IN-IMPL: VarDecl=i:37:17 |
Argyrios Kyrtzidis | 66373dd | 2012-03-30 00:19:05 +0000 | [diff] [blame] | 114 | |
Argyrios Kyrtzidis | b085d89 | 2012-03-30 00:19:18 +0000 | [diff] [blame] | 115 | // RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 \ |
| 116 | // RUN: -cursor-at=%s:50:20 -cursor-at=%s:51:15 -cursor-at=%s:52:20 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s |
Argyrios Kyrtzidis | 66373dd | 2012-03-30 00:19:05 +0000 | [diff] [blame] | 117 | // CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7] |
Argyrios Kyrtzidis | ba1da14 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 118 | // CHECK-MEMBERREF: 40:9 MemberRefExpr=name:23:21 Extent=[40:3 - 40:13] Spelling=name ([40:9 - 40:13]) |
| 119 | // CHECK-MEMBERREF: 50:17 MemberRefExpr=implicitProp:45:7 Extent=[50:11 - 50:29] Spelling=implicitProp ([50:17 - 50:29]) |
| 120 | // CHECK-MEMBERREF: 51:9 MemberRefExpr=setImplicitProp::46:8 Extent=[51:3 - 51:21] Spelling=setImplicitProp: ([51:9 - 51:21]) |
| 121 | // CHECK-MEMBERREF: 52:11 MemberRefExpr=setImplicitProp::46:8 Extent=[52:5 - 52:23] Spelling=setImplicitProp: ([52:11 - 52:23]) |
| 122 | |
| 123 | // RUN: c-index-test -cursor-at=%s:56:24 -cursor-at=%s:60:14 \ |
Argyrios Kyrtzidis | 9482a18 | 2012-04-16 20:01:28 +0000 | [diff] [blame] | 124 | // RUN: -cursor-at=%s:65:20 -cursor-at=%s:67:25 \ |
Argyrios Kyrtzidis | a9d45a3 | 2012-04-16 22:42:01 +0000 | [diff] [blame] | 125 | // RUN: -cursor-at=%s:70:10 -cursor-at=%s:70:16 -cursor-at=%s:70:25 \ |
Argyrios Kyrtzidis | ba1da14 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 126 | // RUN: %s | FileCheck -check-prefix=CHECK-SPELLRANGE %s |
Argyrios Kyrtzidis | 34ebe1e | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 127 | // 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]) Selector index=1 |
| 128 | // 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]) Selector index=0 |
Argyrios Kyrtzidis | 9482a18 | 2012-04-16 20:01:28 +0000 | [diff] [blame] | 129 | // CHECK-SPELLRANGE: 65:12 ObjCCategoryDecl=Dido:65:12 Extent=[65:1 - 66:5] Spelling=Dido ([65:18 - 65:22]) |
| 130 | // CHECK-SPELLRANGE: 67:17 ObjCCategoryImplDecl=Dido:67:17 (Definition) Extent=[67:1 - 68:2] Spelling=Dido ([67:23 - 67:27]) |
Argyrios Kyrtzidis | a9d45a3 | 2012-04-16 22:42:01 +0000 | [diff] [blame] | 131 | |
| 132 | // CHECK-SPELLRANGE: 70:8 ObjCClassRef=Forw1:70:8 Extent=[70:8 - 70:13] Spelling=Forw1 ([70:8 - 70:13]) |
| 133 | // CHECK-SPELLRANGE: 70:15 ObjCClassRef=Forw2:70:15 Extent=[70:15 - 70:20] Spelling=Forw2 ([70:15 - 70:20]) |
| 134 | // CHECK-SPELLRANGE: 70:22 ObjCClassRef=Forw3:70:22 Extent=[70:22 - 70:27] Spelling=Forw3 ([70:22 - 70:27]) |
Argyrios Kyrtzidis | 135bf8e | 2012-06-09 03:03:02 +0000 | [diff] [blame] | 135 | |
| 136 | // RUN: c-index-test -cursor-at=%s:83:15 -cursor-at=%s:83:21 \ |
Argyrios Kyrtzidis | c178d76 | 2012-08-28 00:04:23 +0000 | [diff] [blame] | 137 | // RUN: -cursor-at=%s:84:12 -cursor-at=%s:84:20 \ |
| 138 | // RUN: -cursor-at=%s:99:14 -cursor-at=%s:99:23 %s | FileCheck -check-prefix=CHECK-MULTISYNTH %s |
Argyrios Kyrtzidis | 135bf8e | 2012-06-09 03:03:02 +0000 | [diff] [blame] | 139 | // CHECK-MULTISYNTH: 83:13 ObjCSynthesizeDecl=prop1:76:23 (Definition) Extent=[83:1 - 83:18] Spelling=prop1 ([83:13 - 83:18]) |
| 140 | // CHECK-MULTISYNTH: 83:20 ObjCSynthesizeDecl=prop2:77:23 (Definition) Extent=[83:1 - 83:25] Spelling=prop2 ([83:20 - 83:25]) |
| 141 | // CHECK-MULTISYNTH: 84:10 ObjCDynamicDecl=prop3:78:23 (Definition) Extent=[84:1 - 84:15] Spelling=prop3 ([84:10 - 84:15]) |
| 142 | // CHECK-MULTISYNTH: 84:17 ObjCDynamicDecl=prop4:79:23 (Definition) Extent=[84:1 - 84:22] Spelling=prop4 ([84:17 - 84:22]) |
Argyrios Kyrtzidis | c178d76 | 2012-08-28 00:04:23 +0000 | [diff] [blame] | 143 | // CHECK-MULTISYNTH: 99:13 ObjCSynthesizeDecl=prop1:95:23 (Definition) Extent=[99:1 - 99:27] Spelling=prop1 ([99:13 - 99:18]) |
| 144 | // CHECK-MULTISYNTH: 99:21 MemberRef=_prop1:99:21 Extent=[99:21 - 99:27] Spelling=_prop1 ([99:21 - 99:27]) |
Argyrios Kyrtzidis | a0cff72 | 2012-06-16 00:46:02 +0000 | [diff] [blame] | 145 | |
| 146 | // RUN: c-index-test -cursor-at=%s:86:7 -cursor-at=%s:89:7 %s | FileCheck -check-prefix=CHECK-SELECTORLOC %s |
| 147 | // CHECK-SELECTORLOC: 86:6 ObjCInstanceMethodDecl=meth1:86:6 (Definition) Extent=[86:1 - 88:2] Spelling=meth1 ([86:6 - 86:11]) Selector index=0 |
| 148 | // CHECK-SELECTORLOC: 89:6 ObjCInstanceMethodDecl=meth2:89:6 (Definition) Extent=[89:1 - 91:2] Spelling=meth2 ([89:6 - 89:11]) Selector index=0 |