2010-08-18 04:23:12 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
|
2010-11-09 10:16:57 +08:00
|
|
|
// rdar://8308053
|
2010-08-18 04:23:12 +08:00
|
|
|
|
2011-10-19 03:54:31 +08:00
|
|
|
@class NSObject;
|
|
|
|
|
2010-08-18 04:23:12 +08:00
|
|
|
@interface I {
|
|
|
|
__attribute__((iboutletcollection(I))) id ivar1;
|
|
|
|
__attribute__((iboutletcollection(id))) id ivar2;
|
|
|
|
__attribute__((iboutletcollection())) id ivar3;
|
|
|
|
__attribute__((iboutletcollection)) id ivar4;
|
|
|
|
}
|
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection(I))) id prop1;
|
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection(id))) id prop2;
|
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection())) id prop3;
|
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection)) id prop4;
|
|
|
|
@end
|
|
|
|
|
|
|
|
typedef void *PV;
|
|
|
|
@interface BAD {
|
2011-03-02 20:15:05 +08:00
|
|
|
__attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
|
2010-08-26 07:45:44 +08:00
|
|
|
__attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
|
|
|
|
__attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
|
2012-09-25 06:00:36 +08:00
|
|
|
__attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{instance variable with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
|
2010-08-18 07:19:16 +08:00
|
|
|
__attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
|
2012-09-25 06:00:36 +08:00
|
|
|
__attribute__((iboutlet)) int ivar6; // expected-warning {{instance variable with 'iboutlet' attribute must be an object type}}
|
2010-08-18 04:23:12 +08:00
|
|
|
}
|
2011-03-02 20:15:05 +08:00
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
|
2010-08-26 07:45:44 +08:00
|
|
|
@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
|
2010-08-18 05:39:27 +08:00
|
|
|
|
2011-11-02 02:08:35 +08:00
|
|
|
@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
|
2010-08-18 04:23:12 +08:00
|
|
|
@end
|
|
|
|
|
2011-10-19 01:11:10 +08:00
|
|
|
// rdar://10296078
|
|
|
|
@interface ParentRDar10296078 @end
|
|
|
|
@class NSArray;
|
|
|
|
@protocol RDar10296078_Protocol;
|
|
|
|
@class RDar10296078_OtherClass;
|
|
|
|
|
|
|
|
@interface RDar10296078 : ParentRDar10296078
|
|
|
|
@property (nonatomic, strong)
|
2011-10-19 07:13:50 +08:00
|
|
|
__attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff;
|
2011-10-19 01:11:10 +08:00
|
|
|
@end
|
2013-06-26 01:34:50 +08:00
|
|
|
|
|
|
|
// rdar://14212998
|
|
|
|
@class UILabel;
|
|
|
|
@class NSArray;
|
|
|
|
@interface OCTViewController
|
|
|
|
@property (nonatomic, assign) __attribute__((iboutletcollection(UILabel))) NSArray *labels; // expected-warning {{IBOutletCollection properties should be copy/strong and not assign}}
|
|
|
|
@end
|