1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
5 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
6 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
7 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
9 @property(strong) id x; // expected-note {{property declared here}}
10 @property(strong) id y; // expected-note {{property declared here}}
11 @property(strong) id z;
15 @synthesize x; // expected-note {{property synthesized here}}
16 @synthesize y; // expected-note {{property synthesized here}}
17 @synthesize z; // suppressed
22 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
23 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
24 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
26 @property(retain) id x; // expected-note {{property declared here}}
27 @property(retain) id y; // expected-note {{property declared here}}
28 @property(retain) id z;
32 @synthesize x; // expected-note {{property synthesized here}}
33 @synthesize y; // expected-note {{property synthesized here}}
34 @synthesize z; // suppressed
39 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
40 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
41 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
43 @property(copy) id x; // expected-note {{property declared here}}
44 @property(copy) id y; // expected-note {{property declared here}}
49 @synthesize x; // expected-note {{property synthesized here}}
50 @synthesize y; // expected-note {{property synthesized here}}
51 @synthesize z; // suppressed
55 @property(strong) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
56 @property(strong) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
60 @property(retain) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
61 @property(retain) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
65 @property(copy) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
66 @property(copy) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
70 id __unsafe_unretained x;
71 id y; // expected-error {{existing instance variable 'y' for property 'y' with assign attribute must be __unsafe_unretained}}
73 @property(assign) id __unsafe_unretained x;
74 @property(assign) id y; // expected-note {{property declared here}}
75 @property(assign) id z;
80 @synthesize y; // expected-note {{property synthesized here}}
85 id __unsafe_unretained x;
86 id y; // expected-error {{existing instance variable 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
88 @property(unsafe_unretained) id __unsafe_unretained x;
89 @property(unsafe_unretained) id y; // expected-note {{property declared here}}
90 @property(unsafe_unretained) id z;
95 @synthesize y; // expected-note {{property synthesized here}}
102 @property char isAutosaving;
107 @synthesize isAutosaving = _isAutosaving;
110 // Test for 'Class' properties being unretained.
113 Class _controllerClass;
116 @property (copy) Class controllerClass;
117 @property (copy) id controllerId;
120 @implementation MyClass
121 @synthesize controllerClass = _controllerClass;
122 @synthesize controllerId = _controllerId;
125 @interface UIView @end
128 @interface UIView(UIViewRendering)
129 @property(nonatomic,copy) UIColor *backgroundColor;
132 @interface UILabel : UIView
136 @property (strong) UILabel *label;
139 @interface MyView2 : MyView @end
141 @implementation MyView2
143 super.label.backgroundColor = 0;
149 @property __strong id strong_prop;
150 @property (strong) id strong_attr_prop;
151 @property (strong) __strong id really_strong_attr_prop;
155 - (void) setImplicit : (id) arg;
159 f.prop = [[Baz alloc] init];
160 f.strong_prop = [[Baz alloc] init];
161 f.strong_attr_prop = [[Baz alloc] init];
162 f.really_strong_attr_prop = [[Baz alloc] init];
163 f.implicit = [[Baz alloc] init];
168 const void * innerPointerIvar __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to Objective-C methods and Objective-C properties}}
170 @property (readonly) Boom * NotInnerPointer __attribute__((objc_returns_inner_pointer)); // expected-warning {{'objc_returns_inner_pointer' attribute only applies to properties that return a non-retainable pointer}}
171 - (Boom *) NotInnerPointerMethod __attribute__((objc_returns_inner_pointer)); // expected-warning {{'objc_returns_inner_pointer' attribute only applies to methods that return a non-retainable pointer}}
172 @property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer));
176 id _prop; // expected-error {{existing instance variable '_prop' for property 'prop' with assign attribute must be __unsafe_unretained}}
178 @property (nonatomic, assign) id prop; // expected-note {{property declared here}}
189 @interface Test13885083 : NSObject
191 @property (nonatomic, assign) BOOL retain; // expected-error {{ARC forbids synthesis of 'retain'}}
197 @implementation Test13885083