[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaObjC / arc-unsafe-assigns.m
blob1805b852fb186c0caba9d515fc665481ec53715b
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
2 // rdar://9495837
4 @interface Foo {
5   __unsafe_unretained id unsafe_ivar;
8 @property (assign,nonatomic) id unsafe_prop;
10 - (id)init;
11 + (id)new;
12 + (id)alloc;
14 -(void)Meth;
15 @end
17 @implementation Foo
18 @synthesize unsafe_prop;
19 -(id)init { return self; }
20 +(id)new { return 0; }
21 +(id)alloc { return 0; }
23 -(void)Meth {
24   self.unsafe_prop = [Foo new]; // expected-warning {{assigning retained object to unsafe property}}
25   self->unsafe_ivar = [Foo new]; // expected-warning {{assigning retained object to unsafe_unretained}}
26   self.unsafe_prop = [[Foo alloc] init]; // expected-warning {{assigning retained object to unsafe property}}
27   self->unsafe_ivar = [[Foo alloc] init]; // expected-warning {{assigning retained object to unsafe_unretained}}
29   __unsafe_unretained id unsafe_var;
30   unsafe_var = [Foo new]; // expected-warning {{assigning retained object to unsafe_unretained}}
31   unsafe_var = [[Foo alloc] init]; // expected-warning {{assigning retained object to unsafe_unretained}}
33 @end
35 void bar(Foo *f) {
36   f.unsafe_prop = [Foo new]; // expected-warning {{assigning retained object to unsafe property}}
38   __unsafe_unretained id unsafe_var;
39   unsafe_var = [Foo new]; // expected-warning {{assigning retained object to unsafe_unretained}}
40   unsafe_var = [[Foo alloc] init]; // expected-warning {{assigning retained object to unsafe_unretained}}