xref: /aosp_15_r20/external/clang/test/ARCMT/assign-prop-with-arc-runtime.m.result (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result
2*67e74705SXin Li// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only %s > %t
3*67e74705SXin Li// RUN: diff %t %s.result
4*67e74705SXin Li
5*67e74705SXin Li#include "Common.h"
6*67e74705SXin Li
7*67e74705SXin Li__attribute__((objc_arc_weak_reference_unavailable))
8*67e74705SXin Li@interface WeakOptOut
9*67e74705SXin Li@end
10*67e74705SXin Li
11*67e74705SXin Li@class _NSCachedAttributedString;
12*67e74705SXin Litypedef _NSCachedAttributedString *BadClassForWeak;
13*67e74705SXin Li
14*67e74705SXin Li@class Forw;
15*67e74705SXin Li
16*67e74705SXin Li@interface Foo : NSObject {
17*67e74705SXin Li  Foo *__weak x, *__weak w, *__weak q1, *__weak q2;
18*67e74705SXin Li  WeakOptOut *__unsafe_unretained oo;
19*67e74705SXin Li  BadClassForWeak __unsafe_unretained bcw;
20*67e74705SXin Li  id __unsafe_unretained not_safe1;
21*67e74705SXin Li  NSObject *__unsafe_unretained not_safe2;
22*67e74705SXin Li  Forw *__unsafe_unretained not_safe3;
23*67e74705SXin Li  Foo *assign_plus1;
24*67e74705SXin Li}
25*67e74705SXin Li@property (weak, readonly) Foo *x;
26*67e74705SXin Li@property (weak) Foo *w;
27*67e74705SXin Li@property (weak) Foo *q1, *q2;
28*67e74705SXin Li@property (unsafe_unretained) WeakOptOut *oo;
29*67e74705SXin Li@property (unsafe_unretained) BadClassForWeak bcw;
30*67e74705SXin Li@property (unsafe_unretained) id not_safe1;
31*67e74705SXin Li@property (unsafe_unretained) NSObject *not_safe2;
32*67e74705SXin Li@property (unsafe_unretained) Forw *not_safe3;
33*67e74705SXin Li@property (readonly) Foo *assign_plus1;
34*67e74705SXin Li@property (readonly) Foo *assign_plus2;
35*67e74705SXin Li@property (readonly) Foo *assign_plus3;
36*67e74705SXin Li
37*67e74705SXin Li@property (weak) Foo *no_user_ivar1;
38*67e74705SXin Li@property (weak, readonly) Foo *no_user_ivar2;
39*67e74705SXin Li
40*67e74705SXin Li@property (strong) id def1;
41*67e74705SXin Li@property (atomic,strong) id def2;
42*67e74705SXin Li@property (strong,atomic) id def3;
43*67e74705SXin Li
44*67e74705SXin Li@end
45*67e74705SXin Li
46*67e74705SXin Li@implementation Foo
47*67e74705SXin Li@synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3;
48*67e74705SXin Li@synthesize no_user_ivar1, no_user_ivar2;
49*67e74705SXin Li@synthesize assign_plus1, assign_plus2, assign_plus3;
50*67e74705SXin Li@synthesize def1, def2, def3;
51*67e74705SXin Li
52*67e74705SXin Li-(void)test:(Foo *)parm {
53*67e74705SXin Li  assign_plus1 = [[Foo alloc] init];
54*67e74705SXin Li  assign_plus2 = [Foo new];
55*67e74705SXin Li  assign_plus3 = parm;
56*67e74705SXin Li}
57*67e74705SXin Li@end
58*67e74705SXin Li
59*67e74705SXin Li@interface TestExt
60*67e74705SXin Li@property (strong,readonly) TestExt *x1;
61*67e74705SXin Li@property (weak, readonly) TestExt *x2;
62*67e74705SXin Li@end
63*67e74705SXin Li
64*67e74705SXin Li@interface TestExt()
65*67e74705SXin Li@property (strong,readwrite) TestExt *x1;
66*67e74705SXin Li@property (weak, readwrite) TestExt *x2;
67*67e74705SXin Li@property (strong) TestExt *x3;
68*67e74705SXin Li@end
69*67e74705SXin Li
70*67e74705SXin Li@implementation TestExt
71*67e74705SXin Li@synthesize x1, x2, x3;
72*67e74705SXin Li@end
73