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