blob: c2c523f77e990df1a4e19b25990b0fab7dbe025f [file] [log] [blame]
Argyrios Kyrtzidis12192cf2011-11-07 18:40:29 +00001// 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
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +00003// RUN: diff %t %s.result
Argyrios Kyrtzidis12192cf2011-11-07 18:40:29 +00004// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t
Argyrios Kyrtzidis0d579b62011-11-04 15:58:13 +00005// RUN: diff %t %s.result
Argyrios Kyrtzidisd8b42162012-01-12 02:34:32 +00006// DISABLE: mingw32
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +00007
8#include "Common.h"
Argyrios Kyrtzidis17ac3192011-11-06 18:58:17 +00009#include "GC.h"
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +000010
11void test1(CFTypeRef *cft) {
12 id x = CFBridgingRelease(cft);
13}
Argyrios Kyrtzidise7ef8552011-11-04 15:58:22 +000014
Argyrios Kyrtzidis63787f02012-02-25 01:57:42 +000015@interface I1
Argyrios Kyrtzidise7ef8552011-11-04 15:58:22 +000016@end
17
18@implementation I1
19-(void)dealloc {
20 // dealloc
21 test1(0);
22}
23
24@end
25
26@interface I2
Fariborz Jahanian86f96012012-01-20 19:15:02 +000027@property (strong) id prop;
Argyrios Kyrtzidise7ef8552011-11-04 15:58:22 +000028@end
29
30@implementation I2
31@synthesize prop;
32
33-(void)dealloc {
34 // finalize
35 test1(0);
36}
37@end
Argyrios Kyrtzidis12192cf2011-11-07 18:40:29 +000038
39__attribute__((objc_arc_weak_reference_unavailable))
40@interface QQ {
41 __weak id s;
42 __unsafe_unretained QQ *q;
43}
44@end
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000045
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 {
Fariborz Jahanian2f72ec92012-01-21 00:43:53 +000053 I4Impl *__strong pds2;
Argyrios Kyrtzidisae7c25d2011-11-08 05:56:11 +000054 I4Impl *pds3;
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000055 __weak I4Impl *pw3;
56 __weak I4Impl *pw4;
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000057}
58@property (weak) I4Impl * pw1, * pw2;
Fariborz Jahanian2f72ec92012-01-21 00:43:53 +000059@property (strong) I4Impl * ps;
60@property (strong) I4Impl * pds;
61@property (strong) I4Impl * pds2;
Argyrios Kyrtzidisae7c25d2011-11-08 05:56:11 +000062@property (readwrite) I4Impl * pds3;
Argyrios Kyrtzidisaf9b5e92011-11-08 22:10:58 +000063@property (readonly) I4Impl * pds4;
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000064@property (weak, readonly) I4Impl *pw3;
65@property (weak) I4Impl *pw4;
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000066@end
67
68@implementation I4Impl
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000069@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
Argyrios Kyrtzidisa33849b2011-11-07 18:46:50 +000070
71-(void)test1:(CFTypeRef *)cft {
72 id x = CFBridgingRelease(cft);
73}
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000074@end
Fariborz Jahanian2f72ec92012-01-21 00:43:53 +000075
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
Argyrios Kyrtzidis63787f02012-02-25 01:57:42 +000086
87void test2(id p, __strong I1 *ap[]) {
88 for (__strong I1 *specRule in p) {
89 }
90}