xref: /aosp_15_r20/external/clang/test/ARCMT/GC-no-finalize-removal.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 -no-finalize-removal -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 -no-finalize-removal -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#if !__has_feature(objc_arc)
24*67e74705SXin Li-(void)finalize {
25*67e74705SXin Li  // finalize
26*67e74705SXin Li  test1(0);
27*67e74705SXin Li}
28*67e74705SXin Li#endif
29*67e74705SXin Li@end
30*67e74705SXin Li
31*67e74705SXin Li@interface I2
32*67e74705SXin Li@property (strong) id prop;
33*67e74705SXin Li@end
34*67e74705SXin Li
35*67e74705SXin Li@implementation I2
36*67e74705SXin Li@synthesize prop;
37*67e74705SXin Li
38*67e74705SXin Li#if !__has_feature(objc_arc)
39*67e74705SXin Li-(void)finalize {
40*67e74705SXin Li  self.prop = 0;
41*67e74705SXin Li  // finalize
42*67e74705SXin Li  test1(0);
43*67e74705SXin Li}
44*67e74705SXin Li#endif
45*67e74705SXin Li-(void)dealloc {
46*67e74705SXin Li  // finalize
47*67e74705SXin Li  test1(0);
48*67e74705SXin Li}
49*67e74705SXin Li@end
50*67e74705SXin Li
51*67e74705SXin Li__attribute__((objc_arc_weak_reference_unavailable))
52*67e74705SXin Li@interface QQ {
53*67e74705SXin Li  __weak id s;
54*67e74705SXin Li  __unsafe_unretained QQ *q;
55*67e74705SXin Li}
56*67e74705SXin Li@end
57*67e74705SXin Li
58*67e74705SXin Li@interface I3
59*67e74705SXin Li@property (weak) I3 * pw1, * pw2;
60*67e74705SXin Li@property (strong) I3 * ps;
61*67e74705SXin Li@property (assign) I3 * pds;
62*67e74705SXin Li@end
63*67e74705SXin Li
64*67e74705SXin Li@interface I4Impl {
65*67e74705SXin Li  I4Impl *__strong pds2;
66*67e74705SXin Li  I4Impl *pds3;
67*67e74705SXin Li  __weak I4Impl *pw3;
68*67e74705SXin Li  __weak I4Impl *pw4;
69*67e74705SXin Li}
70*67e74705SXin Li@property (weak) I4Impl * pw1, * pw2;
71*67e74705SXin Li@property (strong) I4Impl * ps;
72*67e74705SXin Li@property (strong) I4Impl * pds;
73*67e74705SXin Li@property (strong) I4Impl * pds2;
74*67e74705SXin Li@property (readwrite) I4Impl * pds3;
75*67e74705SXin Li@property (readonly) I4Impl * pds4;
76*67e74705SXin Li@property (weak, readonly)  I4Impl *pw3;
77*67e74705SXin Li@property (weak)  I4Impl *pw4;
78*67e74705SXin Li@end
79*67e74705SXin Li
80*67e74705SXin Li@implementation I4Impl
81*67e74705SXin Li@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4;
82*67e74705SXin Li
83*67e74705SXin Li-(void)test1:(CFTypeRef *)cft {
84*67e74705SXin Li  id x = CFBridgingRelease(cft);
85*67e74705SXin Li}
86*67e74705SXin Li@end
87*67e74705SXin Li
88*67e74705SXin Li// rdar://10532449
89*67e74705SXin Li@interface rdar10532449
90*67e74705SXin Li@property (strong) id assign_prop;
91*67e74705SXin Li@property (strong, readonly) id  strong_readonly_prop;
92*67e74705SXin Li@property (weak) id  weak_prop;
93*67e74705SXin Li@end
94*67e74705SXin Li
95*67e74705SXin Li@implementation rdar10532449
96*67e74705SXin Li@synthesize assign_prop, strong_readonly_prop, weak_prop;
97*67e74705SXin Li@end
98