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// DISABLE: mingw32
5
6#include "Common.h"
7
8__attribute__((objc_arc_weak_reference_unavailable))
9@interface WeakOptOut
10@end
11
12@class _NSCachedAttributedString;
13typedef _NSCachedAttributedString *BadClassForWeak;
14
15@class Forw;
16
17@interface Foo : NSObject {
18  Foo *x, *w, *q1, *q2;
19  WeakOptOut *oo;
20  BadClassForWeak bcw;
21  id not_safe1;
22  NSObject *not_safe2;
23  Forw *not_safe3;
24  Foo *assign_plus1;
25}
26@property (readonly) Foo *x;
27@property (assign) Foo *w;
28@property Foo *q1, *q2;
29@property (assign) WeakOptOut *oo;
30@property (assign) BadClassForWeak bcw;
31@property (assign) id not_safe1;
32@property () NSObject *not_safe2;
33@property Forw *not_safe3;
34@property (readonly) Foo *assign_plus1;
35@property (readonly) Foo *assign_plus2;
36@property (readonly) Foo *assign_plus3;
37
38@property (assign) Foo *no_user_ivar1;
39@property (readonly) Foo *no_user_ivar2;
40
41@property (retain) id def1;
42@property (atomic,retain) id def2;
43@property (retain,atomic) id def3;
44
45@end
46
47@implementation Foo
48@synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3;
49@synthesize no_user_ivar1, no_user_ivar2;
50@synthesize assign_plus1, assign_plus2, assign_plus3;
51@synthesize def1, def2, def3;
52
53-(void)test:(Foo *)parm {
54  assign_plus1 = [[Foo alloc] init];
55  assign_plus2 = [Foo new];
56  assign_plus3 = [parm retain];
57}
58@end
59
60@interface TestExt
61@property (retain,readonly) TestExt *x1;
62@property (readonly) TestExt *x2;
63@end
64
65@interface TestExt()
66@property (retain,readwrite) TestExt *x1;
67@property (readwrite) TestExt *x2;
68@property (retain) TestExt *x3;
69@end
70
71@implementation TestExt
72@synthesize x1, x2, x3;
73@end
74