1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Wno-objc-root-class -Wreceiver-is-weak -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s 2*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-arc -Wno-objc-root-class -Wreceiver-is-weak -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s 3f4a2713aSLionel Sambuc// rdar://11448209 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc#define READONLY readonly 6f4a2713aSLionel Sambuc 7f4a2713aSLionel Sambuc@class NSView; 8f4a2713aSLionel Sambuc 9*0a6a1f1dSLionel SambucIB_DESIGNABLE @interface I 10f4a2713aSLionel Sambuc@property (getter = MyGetter, readonly, assign) IBOutlet NSView *myView; // expected-warning {{readonly IBOutlet property 'myView' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}} 11f4a2713aSLionel Sambuc 12*0a6a1f1dSLionel SambucIBInspectable @property (readonly) IBOutlet NSView *myView1; // expected-warning {{readonly IBOutlet property 'myView1' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}} 13f4a2713aSLionel Sambuc 14f4a2713aSLionel Sambuc@property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}} 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambuc@end 17f4a2713aSLionel Sambuc 18f4a2713aSLionel Sambuc@implementation I 19f4a2713aSLionel Sambuc@end 20f4a2713aSLionel Sambuc 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc// rdar://13123861 23f4a2713aSLionel Sambuc@class UILabel; 24f4a2713aSLionel Sambuc 25f4a2713aSLionel Sambuc@interface NSObject @end 26f4a2713aSLionel Sambuc 27f4a2713aSLionel Sambuc@interface RKTFHView : NSObject 28f4a2713aSLionel Sambuc@property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadOnly; // expected-warning {{readonly IBOutlet property 'autoReadOnlyReadOnly' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}} 29f4a2713aSLionel Sambuc@property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite; 30f4a2713aSLionel Sambuc@property( readonly ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite; 31f4a2713aSLionel Sambuc@end 32f4a2713aSLionel Sambuc 33f4a2713aSLionel Sambuc@interface RKTFHView() 34f4a2713aSLionel Sambuc@property( readwrite ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite; 35f4a2713aSLionel Sambuc@property( readwrite ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite; 36f4a2713aSLionel Sambuc@end 37f4a2713aSLionel Sambuc 38f4a2713aSLionel Sambuc@implementation RKTFHView 39f4a2713aSLionel Sambuc@synthesize synthReadOnlyReadWrite=_synthReadOnlyReadWrite; 40f4a2713aSLionel Sambuc@end 41*0a6a1f1dSLionel Sambuc 42*0a6a1f1dSLionel Sambuc// rdar://15885642 43*0a6a1f1dSLionel Sambuc@interface WeakOutlet 44*0a6a1f1dSLionel Sambuc@property IBOutlet __weak WeakOutlet* WeakProp; 45*0a6a1f1dSLionel Sambuc@end 46*0a6a1f1dSLionel Sambuc 47*0a6a1f1dSLionel SambucWeakOutlet* func() { 48*0a6a1f1dSLionel Sambuc __weak WeakOutlet* pwi; 49*0a6a1f1dSLionel Sambuc pwi.WeakProp = (WeakOutlet*)0; 50*0a6a1f1dSLionel Sambuc pwi.WeakProp = pwi.WeakProp; 51*0a6a1f1dSLionel Sambuc return pwi.WeakProp; 52*0a6a1f1dSLionel Sambuc} 53