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