Fariborz Jahanian | a8fb24f | 2010-08-17 20:23:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s |
Fariborz Jahanian | 24fce28 | 2010-11-09 02:16:57 +0000 | [diff] [blame] | 3 | // rdar://8308053 |
Fariborz Jahanian | a8fb24f | 2010-08-17 20:23:12 +0000 | [diff] [blame] | 4 | |
Fariborz Jahanian | f4072ae | 2011-10-18 19:54:31 +0000 | [diff] [blame] | 5 | @class NSObject; |
| 6 | |
Fariborz Jahanian | a8fb24f | 2010-08-17 20:23:12 +0000 | [diff] [blame] | 7 | @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 | |
| 19 | typedef void *PV; |
| 20 | @interface BAD { |
John McCall | bdc49d3 | 2011-03-02 12:15:05 +0000 | [diff] [blame] | 21 | __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}} |
Eric Christopher | 0f93758 | 2010-08-25 23:45:44 +0000 | [diff] [blame] | 22 | __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 Kremenek | 0bfaf06 | 2011-11-01 18:08:35 +0000 | [diff] [blame] | 24 | __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}} |
Fariborz Jahanian | 1b72fa7 | 2010-08-17 23:19:16 +0000 | [diff] [blame] | 25 | __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}} |
Ted Kremenek | 0bfaf06 | 2011-11-01 18:08:35 +0000 | [diff] [blame] | 26 | __attribute__((iboutlet)) int ivar6; // expected-warning {{ivar with 'iboutlet' attribute must be an object type}} |
Fariborz Jahanian | a8fb24f | 2010-08-17 20:23:12 +0000 | [diff] [blame] | 27 | } |
John McCall | bdc49d3 | 2011-03-02 12:15:05 +0000 | [diff] [blame] | 28 | @property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}} |
Eric Christopher | 0f93758 | 2010-08-25 23:45:44 +0000 | [diff] [blame] | 29 | @property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}} |
Fariborz Jahanian | 3a3400b | 2010-08-17 21:39:27 +0000 | [diff] [blame] | 30 | |
Ted Kremenek | 0bfaf06 | 2011-11-01 18:08:35 +0000 | [diff] [blame] | 31 | @property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}} |
Fariborz Jahanian | a8fb24f | 2010-08-17 20:23:12 +0000 | [diff] [blame] | 32 | @end |
| 33 | |
Fariborz Jahanian | 7a81e41 | 2011-10-18 17:11:10 +0000 | [diff] [blame] | 34 | // 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 Jahanian | b224343 | 2011-10-18 23:13:50 +0000 | [diff] [blame] | 42 | __attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff; |
Fariborz Jahanian | 7a81e41 | 2011-10-18 17:11:10 +0000 | [diff] [blame] | 43 | @end |