xref: /aosp_15_r20/external/clang/test/ARCMT/remove-dealloc-zerouts.m.result (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
2*67e74705SXin Li// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t
3*67e74705SXin Li// RUN: diff %t %s.result
4*67e74705SXin Li
5*67e74705SXin Li@interface Foo
6*67e74705SXin Li@property (strong) id x;
7*67e74705SXin Li@property (strong) id y;
8*67e74705SXin Li@property (strong) id w;
9*67e74705SXin Li@property (strong) id z;
10*67e74705SXin Li@property (strong) id q;
11*67e74705SXin Li@end
12*67e74705SXin Li
13*67e74705SXin Li@implementation Foo
14*67e74705SXin Li@synthesize x;
15*67e74705SXin Li@synthesize y;
16*67e74705SXin Li@synthesize w;
17*67e74705SXin Li@synthesize q;
18*67e74705SXin Li@dynamic z;
19*67e74705SXin Li
20*67e74705SXin Li- (void) dealloc {
21*67e74705SXin Li  self.z = 0;
22*67e74705SXin Li}
23*67e74705SXin Li@end
24*67e74705SXin Li
25*67e74705SXin Li@interface Bar
26*67e74705SXin Li@property (strong) Foo *a;
27*67e74705SXin Li- (void) setA:(Foo*) val;
28*67e74705SXin Li- (id) a;
29*67e74705SXin Li@end
30*67e74705SXin Li
31*67e74705SXin Li@implementation Bar
32*67e74705SXin Li- (void) dealloc {
33*67e74705SXin Li  [self setA:0];  // This is user-defined setter overriding synthesize, don't touch it.
34*67e74705SXin Li  self.a.x = 0;  // every dealloc must zero out its own ivar. This patter is not recognized.
35*67e74705SXin Li}
36*67e74705SXin Li@synthesize a;
37*67e74705SXin Li- (void) setA:(Foo*) val { }
38*67e74705SXin Li- (id) a {return 0;}
39*67e74705SXin Li@end
40