1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result
2// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -no-finalize-removal -x objective-c %s > %t
3// RUN: diff %t %s.result
4// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -no-finalize-removal -x objective-c++ %s > %t
5// RUN: diff %t %s.result
6// DISABLE: mingw32
7
8#include "Common.h"
9#include "GC.h"
10
11void test1(CFTypeRef *cft) {
12  id x = CFBridgingRelease(cft);
13}
14
15@interface I1
16@end
17
18@implementation I1
19-(void)dealloc {
20  // dealloc
21  test1(0);
22}
23
24#if !__has_feature(objc_arc)
25-(void)finalize {
26  // finalize
27  test1(0);
28}
29#endif
30@end
31
32@interface I2
33@property (strong) id prop;
34@end
35
36@implementation I2
37@synthesize prop;
38
39#if !__has_feature(objc_arc)
40-(void)finalize {
41  self.prop = 0;
42  // finalize
43  test1(0);
44}
45#endif
46-(void)dealloc {
47  // finalize
48  test1(0);
49}
50@end
51
52__attribute__((objc_arc_weak_reference_unavailable))
53@interface QQ {
54  __weak id s;
55  __unsafe_unretained QQ *q;
56}
57@end
58
59@interface I3
60@property (weak) I3 * pw1, * pw2;
61@property (strong) I3 * ps;
62@property (assign) I3 * pds;
63@end
64
65@interface I4Impl {
66  I4Impl *__strong pds2;
67  I4Impl *pds3;
68  __weak I4Impl *pw3;
69  __weak I4Impl *pw4;
70}
71@property (weak) I4Impl * pw1, * pw2;
72@property (strong) I4Impl * ps;
73@property (strong) I4Impl * pds;
74@property (strong) I4Impl * pds2;
75@property (readwrite) I4Impl * pds3;
76@property (readonly) I4Impl * pds4;
77@property (weak, readonly)  I4Impl *pw3;
78@property (weak)  I4Impl *pw4;
79@end
80
81@implementation I4Impl
82@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
83
84-(void)test1:(CFTypeRef *)cft {
85  id x = CFBridgingRelease(cft);
86}
87@end
88
89// rdar://10532449
90@interface rdar10532449
91@property (strong) id assign_prop;
92@property (strong, readonly) id  strong_readonly_prop;
93@property (weak) id  weak_prop;
94@end
95
96@implementation rdar10532449
97@synthesize assign_prop, strong_readonly_prop, weak_prop;
98@end
99