1
- // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
1
+ // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-default-synthesize-properties -fobjc- runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
2
2
// rdar://9340606
3
3
4
4
@interface Foo {
5
5
@public
6
- id __unsafe_unretained x;
7
- id __weak y;
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
8
id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
9
9
}
10
10
@property (strong ) id x; // expected-note {{property declared here}}
@@ -13,15 +13,15 @@ @interface Foo {
13
13
@end
14
14
15
15
@implementation Foo
16
- @synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained }}
17
- @synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak }}
16
+ @synthesize x; // expected-note {{property synthesized here }}
17
+ @synthesize y; // expected-note {{property synthesized here }}
18
18
@synthesize z; // suppressed
19
19
@end
20
20
21
21
@interface Bar {
22
22
@public
23
- id __unsafe_unretained x;
24
- id __weak y;
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
25
id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
26
26
}
27
27
@property (retain ) id x; // expected-note {{property declared here}}
@@ -30,15 +30,15 @@ @interface Bar {
30
30
@end
31
31
32
32
@implementation Bar
33
- @synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained }}
34
- @synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak }}
33
+ @synthesize x; // expected-note {{property synthesized here }}
34
+ @synthesize y; // expected-note {{property synthesized here }}
35
35
@synthesize z; // suppressed
36
36
@end
37
37
38
38
@interface Bas {
39
39
@public
40
- id __unsafe_unretained x;
41
- id __weak y;
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
42
id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
43
43
}
44
44
@property (copy ) id x; // expected-note {{property declared here}}
@@ -47,8 +47,8 @@ @interface Bas {
47
47
@end
48
48
49
49
@implementation Bas
50
- @synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained }}
51
- @synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak }}
50
+ @synthesize x; // expected-note {{property synthesized here }}
51
+ @synthesize y; // expected-note {{property synthesized here }}
52
52
@synthesize z; // suppressed
53
53
@end
54
54
@@ -70,7 +70,7 @@ @interface Bav
70
70
// rdar://9341593
71
71
@interface Gorf {
72
72
id __unsafe_unretained x;
73
- id y;
73
+ id y; // expected-error {{existing instance variable 'y' for property 'y' with assign attribute must be __unsafe_unretained}}
74
74
}
75
75
@property (assign ) id __unsafe_unretained x;
76
76
@property (assign ) id y; // expected-note {{property declared here}}
@@ -79,13 +79,13 @@ @interface Gorf {
79
79
80
80
@implementation Gorf
81
81
@synthesize x;
82
- @synthesize y; // expected-error {{existing instance variable 'y' for property 'y' with assign attribute must be __unsafe_unretained }}
82
+ @synthesize y; // expected-note {{property synthesized here }}
83
83
@synthesize z;
84
84
@end
85
85
86
86
@interface Gorf2 {
87
87
id __unsafe_unretained x;
88
- id y;
88
+ id y; // expected-error {{existing instance variable 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
89
89
}
90
90
@property (unsafe_unretained) id __unsafe_unretained x;
91
91
@property (unsafe_unretained) id y; // expected-note {{property declared here}}
@@ -94,7 +94,7 @@ @interface Gorf2 {
94
94
95
95
@implementation Gorf2
96
96
@synthesize x;
97
- @synthesize y; // expected-error {{existing instance variable 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained }}
97
+ @synthesize y; // expected-note {{property synthesized here }}
98
98
@synthesize z;
99
99
@end
100
100
@@ -173,3 +173,12 @@ void foo(Baz *f) {
173
173
@interface Boom
174
174
@property (readonly ) const void * innerPointer __attribute__ ((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods}}
175
175
@end
176
+
177
+ @interface Foo2 {
178
+ id _prop; // expected-error {{existing instance variable '_prop' for property 'prop' with assign attribute must be __unsafe_unretained}}
179
+ }
180
+ @property (nonatomic , assign ) id prop; // expected-note {{property declared here}}
181
+ @end
182
+
183
+ @implementation Foo2
184
+ @end
0 commit comments