Debian Codegraph @

clang/test/SemaObjC/iboutlet.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Wno-objc-root-class -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 -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s
3
4 #define READONLY readonly
5
6 @class NSView;
7
8 IB_DESIGNABLE @interface I
9 @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}}
10
11 IBInspectable @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}}
12
13 @property (getter = MyGetter2, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}
14
15 @end
16
17 @implementation I
18 @end
19
20 @class UILabel;
21
22 @interface NSObject @end
23
24 @interface RKTFHView : NSObject
25 @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}}
26 @property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite;
27 @property( readonly ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
28 @end
29
30 @interface RKTFHView()
31 @property( readwrite ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite;
32 @property( readwrite ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
33 @end
34
35 @implementation RKTFHView
36 @synthesize synthReadOnlyReadWrite=_synthReadOnlyReadWrite;
37 @end
38
39 @interface WeakOutlet
40 @property int Number;
41 @property IBOutlet __weak WeakOutlet* WeakProp;
42 @end
43
44 WeakOutlet* func(void) {
45 __weak WeakOutlet* pwi;
46 pwi.WeakProp = (WeakOutlet*)0;
47 pwi.WeakProp = pwi.WeakProp;
48 return pwi.WeakProp;
49 }
50
51 WeakOutlet* func2(WeakOutlet* pwi) {
52 [[pwi WeakProp] setNumber:0];
53 [[pwi WeakProp] setNumber:1];
54 return [pwi WeakProp];
55 }