brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.1 KiB · e85d49f Raw
239 lines · plain
1// Test is line- and column-sensitive. Run lines are below.2 3@interface rdar97717154@property (readonly) int foo1;5@property (readwrite) int foo2;6@end7 8@class Foo;9 10@interface rdar9535717 {11  __weak Foo *foo;12}13@end14 15@interface Test1 {16  id _name;17}18@end19@interface Test1 ()20- (id)name;21@end22@interface Test1 ()23@property (copy) id name;24@end25@implementation Test126@synthesize name = _name;27@end28 29@interface rdar1090201530@end31 32@implementation rdar1090201533 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@end43 44@interface Test245-(int)implicitProp;46-(void)setImplicitProp:(int)x;47@end48 49void foo1(Test2 *test2) {50  int x = test2.implicitProp;51  test2.implicitProp = x;52  ++test2.implicitProp;53}54 55@interface Test356-(void)setFoo:(int)x withBar:(int)y;57@end58 59void foo3(Test3 *test3) {60  [test3 setFoo:2 withBar:4];61}62 63@interface Test464@end65@interface Test4(Dido)66@end67@implementation Test4(Dido)68@end69 70@class Forw1, Forw2, Forw3;71 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@end81 82@implementation Test583@synthesize prop1, prop2;84@dynamic prop3, prop4;85 86-(id)meth1 {87  return 0;88}89-(id)meth2{90  return 0;91}92@end93 94@interface Test695@property (assign) id prop1;96@end97 98@implementation Test699@synthesize prop1 = _prop1;100@end101 102@protocol TestProt103-(void)protMeth1;104@property (retain) id propProp1;105 106@optional107-(void)protMeth2;108@property (retain) id propProp2;109 110@required111-(void)protMeth3;112@property (retain) id propProp3;113@end114 115@interface TestNullability116@property (strong, nonnull) id prop1;117@property (strong, nullable) id prop2;118@end119 120@implementation TestNullability121- (void)meth {122  TestNullability *o;123  [o.prop1 meth];124  [o.prop2 meth];125  _Nullable id lo1;126  _Nonnull id lo2;127  [lo1 meth];128  [lo2 meth];129}130@end131 132#define NS_ENUM(_name, _type) enum _name : _type _name; enum _name : _type133typedef NS_ENUM(TestTransparent, int) {134  TestTransparentFirst = 0,135  TestTransparentSecond = 1,136};137typedef enum TestTransparent NotTransparent;138 139TestTransparent transparentTypedef;140enum TestTransparent transparentUnderlying;141NotTransparent opaqueTypedef;142 143#define MY_ENUM(_name, _type) enum _name : _type _name##_t; enum _name : _type144typedef MY_ENUM(TokenPaste, int) {145  TokenPasteFirst = 0,146};147TokenPaste_t opaqueTypedef2;148 149#define MY_TYPE(_name) struct _name _name; struct _name150typedef MY_TYPE(SomeT) { int x; };151SomeT someVar;152 153#define MY_TYPE2(_name) struct _name *_name; struct _name154typedef MY_TYPE2(SomeT2) { int x; };155SomeT2 someVar2;156 157#define GEN_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name, generated_declaration)))158 159GEN_DECL("some_module")160@interface ExtCls161-(void)method;162@end163 164// RUN: c-index-test -cursor-at=%s:4:28 -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP %s165// CHECK-PROP: ObjCPropertyDecl=foo1:4:26166// CHECK-PROP: ObjCPropertyDecl=foo2:5:27167 168// RUN: c-index-test -cursor-at=%s:11:11 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s169// CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8170 171// RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s172// CHECK-METHOD: 20:7 ObjCInstanceMethodDecl=name:20:7 Extent=[20:1 - 20:12]173 174// RUN: c-index-test -cursor-at=%s:37:17 %s | FileCheck -check-prefix=CHECK-IN-IMPL %s175// CHECK-IN-IMPL: VarDecl=i:37:17176 177// RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 \178// RUN:   -cursor-at=%s:50:20 -cursor-at=%s:51:15 -cursor-at=%s:52:20 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s179// CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7]180// CHECK-MEMBERREF: 40:9 MemberRefExpr=name:23:21 Extent=[40:3 - 40:13] Spelling=name ([40:9 - 40:13])181// CHECK-MEMBERREF: 50:17 MemberRefExpr=implicitProp:45:7 Extent=[50:11 - 50:29] Spelling=implicitProp ([50:17 - 50:29])182// CHECK-MEMBERREF: 51:9 MemberRefExpr=setImplicitProp::46:8 Extent=[51:3 - 51:21] Spelling=setImplicitProp: ([51:9 - 51:21])183// CHECK-MEMBERREF: 52:11 MemberRefExpr=setImplicitProp::46:8 Extent=[52:5 - 52:23] Spelling=setImplicitProp: ([52:11 - 52:23])184 185// RUN: c-index-test -cursor-at=%s:56:24 -cursor-at=%s:60:14 \186// RUN:   -cursor-at=%s:65:20 -cursor-at=%s:67:25 \187// RUN:   -cursor-at=%s:70:10 -cursor-at=%s:70:16 -cursor-at=%s:70:25 \188// RUN:   %s | FileCheck -check-prefix=CHECK-SPELLRANGE %s189// 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=1190// 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=0191// CHECK-SPELLRANGE: 65:12 ObjCCategoryDecl=Dido:65:12 Extent=[65:1 - 66:5] Spelling=Dido ([65:18 - 65:22])192// CHECK-SPELLRANGE: 67:17 ObjCCategoryImplDecl=Dido:67:17 (Definition) Extent=[67:1 - 68:2] Spelling=Dido ([67:23 - 67:27])193 194// CHECK-SPELLRANGE: 70:8 ObjCClassRef=Forw1:70:8 Extent=[70:8 - 70:13] Spelling=Forw1 ([70:8 - 70:13])195// CHECK-SPELLRANGE: 70:15 ObjCClassRef=Forw2:70:15 Extent=[70:15 - 70:20] Spelling=Forw2 ([70:15 - 70:20])196// CHECK-SPELLRANGE: 70:22 ObjCClassRef=Forw3:70:22 Extent=[70:22 - 70:27] Spelling=Forw3 ([70:22 - 70:27])197 198// RUN: c-index-test -cursor-at=%s:83:15 -cursor-at=%s:83:21 \199// RUN:              -cursor-at=%s:84:12 -cursor-at=%s:84:20 \200// RUN:              -cursor-at=%s:99:14 -cursor-at=%s:99:23 %s | FileCheck -check-prefix=CHECK-MULTISYNTH %s201// CHECK-MULTISYNTH: 83:13 ObjCSynthesizeDecl=prop1:76:23 (Definition) Extent=[83:1 - 83:18] Spelling=prop1 ([83:13 - 83:18])202// CHECK-MULTISYNTH: 83:20 ObjCSynthesizeDecl=prop2:77:23 (Definition) Extent=[83:1 - 83:25] Spelling=prop2 ([83:20 - 83:25])203// CHECK-MULTISYNTH: 84:10 ObjCDynamicDecl=prop3:78:23 (Definition) Extent=[84:1 - 84:15] Spelling=prop3 ([84:10 - 84:15])204// CHECK-MULTISYNTH: 84:17 ObjCDynamicDecl=prop4:79:23 (Definition) Extent=[84:1 - 84:22] Spelling=prop4 ([84:17 - 84:22])205// CHECK-MULTISYNTH: 99:13 ObjCSynthesizeDecl=prop1:95:23 (Definition) Extent=[99:1 - 99:27] Spelling=prop1 ([99:13 - 99:18])206// CHECK-MULTISYNTH: 99:21 MemberRef=_prop1:99:21 Extent=[99:21 - 99:27] Spelling=_prop1 ([99:21 - 99:27])207 208// RUN: c-index-test -cursor-at=%s:86:7 -cursor-at=%s:89:7 %s | FileCheck -check-prefix=CHECK-SELECTORLOC %s209// CHECK-SELECTORLOC: 86:6 ObjCInstanceMethodDecl=meth1:86:6 (Definition) Extent=[86:1 - 88:2] Spelling=meth1 ([86:6 - 86:11]) Selector index=0210// CHECK-SELECTORLOC: 89:6 ObjCInstanceMethodDecl=meth2:89:6 (Definition) Extent=[89:1 - 91:2] Spelling=meth2 ([89:6 - 89:11]) Selector index=0211 212// RUN: c-index-test -cursor-at=%s:103:10 -cursor-at=%s:104:10 \213// RUN:              -cursor-at=%s:107:10 -cursor-at=%s:108:10 \214// RUN:              -cursor-at=%s:111:10 -cursor-at=%s:112:10 %s | FileCheck -check-prefix=CHECK-OBJCOPTIONAL %s215// CHECK-OBJCOPTIONAL: 103:8 ObjCInstanceMethodDecl=protMeth1:103:8 Extent=[103:1 - 103:18]216// CHECK-OBJCOPTIONAL: 104:23 ObjCPropertyDecl=propProp1:104:23 [retain,] Extent=[104:1 - 104:32]217// CHECK-OBJCOPTIONAL: 107:8 ObjCInstanceMethodDecl=protMeth2:107:8 (@optional) Extent=[107:1 - 107:18]218// CHECK-OBJCOPTIONAL: 108:23 ObjCPropertyDecl=propProp2:108:23 (@optional) [retain,] Extent=[108:1 - 108:32]219// CHECK-OBJCOPTIONAL: 111:8 ObjCInstanceMethodDecl=protMeth3:111:8 Extent=[111:1 - 111:18]220// CHECK-OBJCOPTIONAL: 112:23 ObjCPropertyDecl=propProp3:112:23 [retain,] Extent=[112:1 - 112:32]221 222// RUN: c-index-test -cursor-at=%s:123:12 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s223// RUN: c-index-test -cursor-at=%s:124:12 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s224// RUN: c-index-test -cursor-at=%s:127:8 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s225// RUN: c-index-test -cursor-at=%s:128:8 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s226// CHECK-RECEIVER-WITH-NULLABILITY: Receiver-type=ObjCId227 228// RUN: c-index-test -cursor-at=%s:139:1 -cursor-at=%s:140:6 -cursor-at=%s:141:1 -cursor-at=%s:147:1 -cursor-at=%s:151:1 -cursor-at=%s:155:1 %s | FileCheck -check-prefix=CHECK-TRANSPARENT %s229// CHECK-TRANSPARENT: 139:1 TypeRef=TestTransparent:133:17 (Transparent: enum TestTransparent) Extent=[139:1 - 139:16] Spelling=TestTransparent ([139:1 - 139:16])230// CHECK-TRANSPARENT: 140:6 TypeRef=enum TestTransparent:133:17 Extent=[140:6 - 140:21] Spelling=enum TestTransparent ([140:6 - 140:21])231// CHECK-TRANSPARENT: 141:1 TypeRef=NotTransparent:137:30 Extent=[141:1 - 141:15] Spelling=NotTransparent ([141:1 - 141:15])232// CHECK-TRANSPARENT: 147:1 TypeRef=TokenPaste_t:144:9 Extent=[147:1 - 147:13] Spelling=TokenPaste_t ([147:1 - 147:13])233// CHECK-TRANSPARENT: 151:1 TypeRef=SomeT:150:17 (Transparent: struct SomeT) Extent=[151:1 - 151:6] Spelling=SomeT ([151:1 - 151:6])234// CHECK-TRANSPARENT: 155:1 TypeRef=SomeT2:154:18 Extent=[155:1 - 155:7] Spelling=SomeT2 ([155:1 - 155:7])235 236// RUN: c-index-test -cursor-at=%s:160:12 -cursor-at=%s:161:8 %s | FileCheck -check-prefix=CHECK-EXTERNAL %s237// CHECK-EXTERNAL: 160:12 ObjCInterfaceDecl=ExtCls:160:12 (external lang: Swift, defined: some_module, gen: 1)238// CHECK-EXTERNAL: 161:8 ObjCInstanceMethodDecl=method:161:8 (external lang: Swift, defined: some_module, gen: 1)239C