blob: 2cf6b8e24481cf56c2c2451c6e29698f4253224f [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 Kyrtzidis17ac3192011-11-06 18:58:17 +000015@interface I1 {
16 I1 *myivar;
17}
Argyrios Kyrtzidise7ef8552011-11-04 15:58:22 +000018@end
19
20@implementation I1
21-(void)dealloc {
22 // dealloc
23 test1(0);
24}
25
26@end
27
28@interface I2
Fariborz Jahanian86f96012012-01-20 19:15:02 +000029@property (strong) id prop;
Argyrios Kyrtzidise7ef8552011-11-04 15:58:22 +000030@end
31
32@implementation I2
33@synthesize prop;
34
35-(void)dealloc {
36 // finalize
37 test1(0);
38}
39@end
Argyrios Kyrtzidis12192cf2011-11-07 18:40:29 +000040
41__attribute__((objc_arc_weak_reference_unavailable))
42@interface QQ {
43 __weak id s;
44 __unsafe_unretained QQ *q;
45}
46@end
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000047
48@interface I3
49@property (weak) I3 * pw1, * pw2;
50@property (strong) I3 * ps;
51@property (assign) I3 * pds;
52@end
53
54@interface I4Impl {
55 I4Impl *pds2;
Argyrios Kyrtzidisae7c25d2011-11-08 05:56:11 +000056 I4Impl *pds3;
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000057 __weak I4Impl *pw3;
58 __weak I4Impl *pw4;
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000059}
60@property (weak) I4Impl * pw1, * pw2;
61@property I4Impl * ps;
62@property I4Impl * pds;
63@property I4Impl * pds2;
Argyrios Kyrtzidisae7c25d2011-11-08 05:56:11 +000064@property (readwrite) I4Impl * pds3;
Argyrios Kyrtzidisaf9b5e92011-11-08 22:10:58 +000065@property (readonly) I4Impl * pds4;
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000066@property (weak, readonly) I4Impl *pw3;
67@property (weak) I4Impl *pw4;
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000068@end
69
70@implementation I4Impl
Argyrios Kyrtzidis6d7d16d2011-11-28 00:23:12 +000071@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
Argyrios Kyrtzidisa33849b2011-11-07 18:46:50 +000072
73-(void)test1:(CFTypeRef *)cft {
74 id x = CFBridgingRelease(cft);
75}
Argyrios Kyrtzidisb0e1e122011-11-07 18:46:46 +000076@end