Home | History | Annotate | Download | only in SemaObjC
      1 // 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 // 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
      3 // rdar://11448209
      4 
      5 #define READONLY readonly
      6 
      7 @class NSView;
      8 
      9 #define IBOutlet __attribute__((iboutlet))
     10 
     11 @interface I
     12 @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}}
     13 
     14 @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}}
     15 
     16 @property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}
     17 
     18 @end
     19 
     20 @implementation I
     21 @end
     22 
     23 
     24 // rdar://13123861
     25 @class UILabel;
     26 
     27 @interface NSObject @end
     28 
     29 @interface RKTFHView : NSObject
     30 @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}}
     31 @property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite;
     32 @property( readonly ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
     33 @end
     34 
     35 @interface RKTFHView()
     36 @property( readwrite ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite;
     37 @property( readwrite ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
     38 @end
     39 
     40 @implementation RKTFHView
     41 @synthesize synthReadOnlyReadWrite=_synthReadOnlyReadWrite;
     42 @end
     43 
     44 // rdar://15885642
     45 @interface WeakOutlet 
     46 @property IBOutlet __weak WeakOutlet* WeakProp;
     47 @end
     48 
     49 WeakOutlet* func() {
     50   __weak WeakOutlet* pwi;
     51   pwi.WeakProp = (WeakOutlet*)0;
     52   pwi.WeakProp = pwi.WeakProp;
     53   return pwi.WeakProp;
     54 }
     55