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