blob: f55ca38070e9e6aa218bfb8705b4dcded3bc76bc [file] [log] [blame]
Argyrios Kyrtzidis7cfd7fe2011-11-08 02:02:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-macosx10.6 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result
2// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -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.6 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t
5// RUN: diff %t %s.result
Argyrios Kyrtzidisd8b42162012-01-12 02:34:32 +00006// DISABLE: mingw32
Argyrios Kyrtzidis7cfd7fe2011-11-08 02:02:38 +00007
8#include "Common.h"
9#include "GC.h"
10
11void test1(CFTypeRef *cft) {
12 id x = CFBridgingRelease(cft);
13}
14
Argyrios Kyrtzidis63787f02012-02-25 01:57:42 +000015@interface I1
Argyrios Kyrtzidis7cfd7fe2011-11-08 02:02:38 +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 Kyrtzidis7cfd7fe2011-11-08 02:02:38 +000028@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 __unsafe_unretained id s;
42 __unsafe_unretained QQ *q;
43}
44@end
45
46@interface I3
47@property (unsafe_unretained) 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 Kyrtzidis7cfd7fe2011-11-08 02:02:38 +000054}
55@property (unsafe_unretained) I4Impl * pw1, * pw2;
Fariborz Jahanian2f72ec92012-01-21 00:43:53 +000056@property (strong) I4Impl * ps;
57@property (strong) I4Impl * pds;
58@property (strong) I4Impl * pds2;
Argyrios Kyrtzidis7cfd7fe2011-11-08 02:02:38 +000059@end
60
61@implementation I4Impl
62@synthesize pw1, pw2, ps, pds, pds2;
63
64-(void)test1:(CFTypeRef *)cft {
65 id x = CFBridgingRelease(cft);
66}
67@end
Argyrios Kyrtzidis6da42742011-11-28 02:04:36 +000068
69@interface I5 {
70 __unsafe_unretained id prop;
71}
72@property (unsafe_unretained, readonly) id prop;
73@end