1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
6 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
7 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
8 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
10 @property(strong) id x; // expected-note {{property declared here}}
11 @property(strong) id y; // expected-note {{property declared here}}
12 @property(strong) id z;
16 @synthesize x; // expected-note {{property synthesized here}}
17 @synthesize y; // expected-note {{property synthesized here}}
18 @synthesize z; // suppressed
23 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
24 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
25 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
27 @property(retain) id x; // expected-note {{property declared here}}
28 @property(retain) id y; // expected-note {{property declared here}}
29 @property(retain) id z;
33 @synthesize x; // expected-note {{property synthesized here}}
34 @synthesize y; // expected-note {{property synthesized here}}
35 @synthesize z; // suppressed
40 id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
41 id __weak y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
42 id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
44 @property(copy) id x; // expected-note {{property declared here}}
45 @property(copy) id y; // expected-note {{property declared here}}
50 @synthesize x; // expected-note {{property synthesized here}}
51 @synthesize y; // expected-note {{property synthesized here}}
52 @synthesize z; // suppressed
56 @property(strong) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
57 @property(strong) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
61 @property(retain) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
62 @property(retain) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
66 @property(copy) __unsafe_unretained id x; // expected-error {{strong property 'x' may not also be declared __unsafe_unretained}}
67 @property(copy) __autoreleasing id z; // expected-error {{strong property 'z' may not also be declared __autoreleasing}}
72 id __unsafe_unretained x;
73 id y; // expected-error {{existing instance variable 'y' for property 'y' with assign attribute must be __unsafe_unretained}}
75 @property(assign) id __unsafe_unretained x;
76 @property(assign) id y; // expected-note {{property declared here}}
77 @property(assign) id z;
82 @synthesize y; // expected-note {{property synthesized here}}
87 id __unsafe_unretained x;
88 id y; // expected-error {{existing instance variable 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
90 @property(unsafe_unretained) id __unsafe_unretained x;
91 @property(unsafe_unretained) id y; // expected-note {{property declared here}}
92 @property(unsafe_unretained) id z;
97 @synthesize y; // expected-note {{property synthesized here}}
105 @property char isAutosaving;
110 @synthesize isAutosaving = _isAutosaving;
114 // Test for 'Class' properties being unretained.
117 Class _controllerClass;
120 @property (copy) Class controllerClass;
121 @property (copy) id controllerId;
124 @implementation MyClass
125 @synthesize controllerClass = _controllerClass;
126 @synthesize controllerId = _controllerId;
130 @interface UIView @end
133 @interface UIView(UIViewRendering)
134 @property(nonatomic,copy) UIColor *backgroundColor;
137 @interface UILabel : UIView
141 @property (strong) UILabel *label;
144 @interface MyView2 : MyView @end
146 @implementation MyView2
148 super.label.backgroundColor = 0;
155 @property __strong id strong_prop;
156 @property (strong) id strong_attr_prop;
157 @property (strong) __strong id really_strong_attr_prop;
161 - (void) setImplicit : (id) arg;
165 f.prop = [[Baz alloc] init];
166 f.strong_prop = [[Baz alloc] init];
167 f.strong_attr_prop = [[Baz alloc] init];
168 f.really_strong_attr_prop = [[Baz alloc] init];
169 f.implicit = [[Baz alloc] init];
175 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}}
177 @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}}
178 - (Boom *) NotInnerPointerMethod __attribute__((objc_returns_inner_pointer)); // expected-warning {{'objc_returns_inner_pointer' attribute only applies to methods that return a non-retainable pointer}}
179 @property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer));
183 id _prop; // expected-error {{existing instance variable '_prop' for property 'prop' with assign attribute must be __unsafe_unretained}}
185 @property (nonatomic, assign) id prop; // expected-note {{property declared here}}
197 @interface Test13885083 : NSObject
199 @property (nonatomic, assign) BOOL retain; // expected-error {{ARC forbids synthesis of 'retain'}}
205 @implementation Test13885083