annotate clang/test/SemaObjC/iboutletcollection-attr.m @ 180:680fa57a2f20

fix compile errors.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 May 2020 17:44:06 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
3 // rdar://8308053
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 @class NSObject;
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 @interface I {
anatofuz
parents:
diff changeset
8 __attribute__((iboutletcollection(I))) id ivar1;
anatofuz
parents:
diff changeset
9 __attribute__((iboutletcollection(id))) id ivar2;
anatofuz
parents:
diff changeset
10 __attribute__((iboutletcollection())) id ivar3;
anatofuz
parents:
diff changeset
11 __attribute__((iboutletcollection)) id ivar4;
anatofuz
parents:
diff changeset
12 }
anatofuz
parents:
diff changeset
13 @property (nonatomic, retain) __attribute__((iboutletcollection(I))) id prop1;
anatofuz
parents:
diff changeset
14 @property (nonatomic, retain) __attribute__((iboutletcollection(id))) id prop2;
anatofuz
parents:
diff changeset
15 @property (nonatomic, retain) __attribute__((iboutletcollection())) id prop3;
anatofuz
parents:
diff changeset
16 @property (nonatomic, retain) __attribute__((iboutletcollection)) id prop4;
anatofuz
parents:
diff changeset
17 @end
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 typedef void *PV;
anatofuz
parents:
diff changeset
20 @interface BAD {
anatofuz
parents:
diff changeset
21 __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{expected ')'}} expected-note {{to match}}
anatofuz
parents:
diff changeset
22 __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{unknown type name 'B'}}
anatofuz
parents:
diff changeset
23 __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' (aka 'void *') as argument of iboutletcollection attribute}}
anatofuz
parents:
diff changeset
24 __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{instance variable with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
anatofuz
parents:
diff changeset
25 __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
anatofuz
parents:
diff changeset
26 __attribute__((iboutlet)) int ivar6; // expected-warning {{instance variable with 'iboutlet' attribute must be an object type}}
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 @property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{expected ')'}} expected-note {{to match}}
anatofuz
parents:
diff changeset
29 @property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{unknown type name 'B'}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 @property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
anatofuz
parents:
diff changeset
32 @end
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 // rdar://10296078
anatofuz
parents:
diff changeset
35 @interface ParentRDar10296078 @end
anatofuz
parents:
diff changeset
36 @class NSArray;
anatofuz
parents:
diff changeset
37 @protocol RDar10296078_Protocol;
anatofuz
parents:
diff changeset
38 @class RDar10296078_OtherClass;
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 @interface RDar10296078 : ParentRDar10296078
anatofuz
parents:
diff changeset
41 @property (nonatomic, strong)
anatofuz
parents:
diff changeset
42 __attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff;
anatofuz
parents:
diff changeset
43 @end
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 // rdar://14212998
anatofuz
parents:
diff changeset
46 @class UILabel;
anatofuz
parents:
diff changeset
47 @class NSArray;
anatofuz
parents:
diff changeset
48 @interface OCTViewController
anatofuz
parents:
diff changeset
49 @property (nonatomic, assign) __attribute__((iboutletcollection(UILabel))) NSArray *labels; // expected-warning {{IBOutletCollection properties should be copy/strong and not assign}}
anatofuz
parents:
diff changeset
50 @end