summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/arc-property.m
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjC/arc-property.m')
-rw-r--r--clang/test/SemaObjC/arc-property.m57
1 files changed, 57 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/arc-property.m b/clang/test/SemaObjC/arc-property.m
new file mode 100644
index 0000000..2599fb9
--- /dev/null
+++ b/clang/test/SemaObjC/arc-property.m
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
+// rdar://9309489
+
+@interface MyClass {
+ id __weak myString;
+ id StrongIvar;
+ id __weak myString2;
+ id __weak myString3;
+ id StrongIvar5;
+}
+@property (strong) id myString; // expected-note {{property declared here}}
+@property (strong) id myString1;
+@property (retain) id myString2; // expected-note {{property declared here}}
+//
+@property (weak) id myString3;
+@property (weak) id myString4;
+@property __weak id myString5; // expected-note {{property declared here}}
+@end
+
+@implementation MyClass
+@synthesize myString; // expected-error {{existing ivar 'myString' for strong property 'myString' may not be __weak}}
+@synthesize myString1 = StrongIvar; // OK
+@synthesize myString2 = myString2; // expected-error {{existing ivar 'myString2' for strong property 'myString2' may not be __weak}}
+//
+@synthesize myString3; // OK
+@synthesize myString4; // OK
+@synthesize myString5 = StrongIvar5; // expected-error {{existing ivar 'StrongIvar5' for __weak property 'myString5' must be __weak}}
+
+@end
+
+// rdar://9340692
+@interface Foo {
+@public
+ id __unsafe_unretained x; // should be __weak
+ id __strong y;
+ id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+}
+@property(weak) id x; // expected-note {{property declared here}}
+@property(weak) id y; // expected-note {{property declared here}}
+@property(weak) id z;
+@end
+
+@implementation Foo
+@synthesize x; // expected-error {{existing ivar 'x' for __weak property 'x' must be __weak}}
+@synthesize y; // expected-error {{existing ivar 'y' for __weak property 'y' must be __weak}}
+@synthesize z; // suppressed
+@end
+
+// rdar://problem/10904479
+// Don't crash.
+@interface Test2
+// Minor FIXME: kill the redundant error
+@property (strong) UndeclaredClass *test2; // expected-error {{unknown type name 'UndeclaredClass'}} expected-error {{must be of object type}}
+@end
+@implementation Test2
+@synthesize test2;
+@end