brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 0bc0de4 Raw
62 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -fobjc-exceptions -verify -Wno-objc-root-class %s2 3@interface MyClass {4        id __weak myString; // expected-error {{existing instance variable 'myString' for strong property 'myString' may not be __weak}}5        id StrongIvar;6        id __weak myString2; // expected-error {{existing instance variable 'myString2' for strong property 'myString2' may not be __weak}}7        id __weak myString3;8        id StrongIvar5; // expected-error {{existing instance variable 'StrongIvar5' for __weak property 'myString5' must be __weak}}9}10@property (strong) id myString; // expected-note {{property declared here}}11@property (strong) id myString1;12@property (retain) id myString2; // expected-note {{property declared here}}13//14@property (weak) id myString3;15@property (weak) id myString4;16@property __weak id myString5; // expected-note {{property declared here}}17@end18 19@implementation MyClass20@synthesize myString; // expected-note {{property synthesized here}}21@synthesize myString1 = StrongIvar; // OK22@synthesize myString2 = myString2; // expected-note {{property synthesized here}}23//24@synthesize myString3; // OK25@synthesize myString4; // OK26@synthesize myString5 = StrongIvar5; // expected-note {{property synthesized here}}27 28@end29 30@interface Foo {31@public32    id __unsafe_unretained x; // expected-error {{existing instance variable 'x' for __weak property 'x' must be __weak}}33    id __strong y;  // expected-error {{existing instance variable 'y' for __weak property 'y' must be __weak}}34    id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}35}36@property(weak) id x; // expected-note {{property declared here}}37@property(weak) id y; // expected-note {{property declared here}}38@property(weak) id z;39@end40 41@implementation Foo42@synthesize x; // expected-note {{property synthesized here}}43@synthesize y; // expected-note {{property synthesized here}}44@synthesize z;  // suppressed45@end46 47// Don't crash.48@interface Test249// Minor FIXME: kill the redundant error50@property (strong) UndeclaredClass *test2;  // expected-error {{unknown type name 'UndeclaredClass'}} expected-error {{must be of object type}}51@end52@implementation Test253@synthesize test2;54@end55 56@interface Test357@property (strong) id exception;58@end59void test3(Test3 *t3) {60  @throw t3.exception;61}62