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 -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 -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@end
25
26@interface I2
27@property (strong) id prop;
28@end
29
30@implementation I2
31@synthesize prop;
32
33-(void)dealloc {
34  // finalize
35  test1(0);
36}
37@end
38
39__attribute__((objc_arc_weak_reference_unavailable))
40@interface QQ {
41  __weak id s;
42  __unsafe_unretained QQ *q;
43}
44@end
45
46@interface I3
47@property (weak) I3 * pw1, * pw2;
48@property (strong) I3 * ps;
49@property (assign) I3 * pds;
50@end
51
52@interface I4Impl {
53  I4Impl *__strong pds2;
54  I4Impl *pds3;
55  __weak I4Impl *pw3;
56  __weak I4Impl *pw4;
57}
58@property (weak) I4Impl * pw1, * pw2;
59@property (strong) I4Impl * ps;
60@property (strong) I4Impl * pds;
61@property (strong) I4Impl * pds2;
62@property (readwrite) I4Impl * pds3;
63@property (readonly) I4Impl * pds4;
64@property (weak, readonly)  I4Impl *pw3;
65@property (weak)  I4Impl *pw4;
66@end
67
68@implementation I4Impl
69@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
70
71-(void)test1:(CFTypeRef *)cft {
72  id x = CFBridgingRelease(cft);
73}
74@end
75
76// rdar://10532449
77@interface rdar10532449
78@property (strong) id assign_prop;
79@property (strong, readonly) id  strong_readonly_prop;
80@property (weak) id  weak_prop;
81@end
82
83@implementation rdar10532449
84@synthesize assign_prop, strong_readonly_prop, weak_prop;
85@end
86
87void test2(id p, __strong I1 *ap[]) {
88  for (__strong I1 *specRule in p) {
89  }
90}
91