diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaObjC/arc-property.m | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaObjC/arc-property.m')
-rw-r--r-- | clang/test/SemaObjC/arc-property.m | 57 |
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 |