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