blob: 22c21a764bdcd476dc089a2b230ad12d119ee87f [file] [log] [blame]
Fariborz Jahaniana8fb24f2010-08-17 20:23:12 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
Fariborz Jahanian24fce282010-11-09 02:16:57 +00003// rdar://8308053
Fariborz Jahaniana8fb24f2010-08-17 20:23:12 +00004
Fariborz Jahanianf4072ae2011-10-18 19:54:31 +00005@class NSObject;
6
Fariborz Jahaniana8fb24f2010-08-17 20:23:12 +00007@interface I {
8 __attribute__((iboutletcollection(I))) id ivar1;
9 __attribute__((iboutletcollection(id))) id ivar2;
10 __attribute__((iboutletcollection())) id ivar3;
11 __attribute__((iboutletcollection)) id ivar4;
12}
13@property (nonatomic, retain) __attribute__((iboutletcollection(I))) id prop1;
14@property (nonatomic, retain) __attribute__((iboutletcollection(id))) id prop2;
15@property (nonatomic, retain) __attribute__((iboutletcollection())) id prop3;
16@property (nonatomic, retain) __attribute__((iboutletcollection)) id prop4;
17@end
18
19typedef void *PV;
20@interface BAD {
John McCallbdc49d32011-03-02 12:15:05 +000021 __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
Eric Christopher0f937582010-08-25 23:45:44 +000022 __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
23 __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
Ted Kremenek0bfaf062011-11-01 18:08:35 +000024 __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
Fariborz Jahanian1b72fa72010-08-17 23:19:16 +000025 __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
Ted Kremenek0bfaf062011-11-01 18:08:35 +000026 __attribute__((iboutlet)) int ivar6; // expected-warning {{ivar with 'iboutlet' attribute must be an object type}}
Fariborz Jahaniana8fb24f2010-08-17 20:23:12 +000027}
John McCallbdc49d32011-03-02 12:15:05 +000028@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
Eric Christopher0f937582010-08-25 23:45:44 +000029@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
Fariborz Jahanian3a3400b2010-08-17 21:39:27 +000030
Ted Kremenek0bfaf062011-11-01 18:08:35 +000031@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
Fariborz Jahaniana8fb24f2010-08-17 20:23:12 +000032@end
33
Fariborz Jahanian7a81e412011-10-18 17:11:10 +000034// rdar://10296078
35@interface ParentRDar10296078 @end
36@class NSArray;
37@protocol RDar10296078_Protocol;
38@class RDar10296078_OtherClass;
39
40@interface RDar10296078 : ParentRDar10296078
41@property (nonatomic, strong)
Fariborz Jahanianb2243432011-10-18 23:13:50 +000042 __attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff;
Fariborz Jahanian7a81e412011-10-18 17:11:10 +000043@end