Debian Codegraph @

clang/docs/analyzer/checkers/dealloc_example.m

raw
1
2
3 @interface MyObject : NSObject {
4 id _myproperty;
5 }
6 @end
7
8 @implementation MyObject // warn: lacks 'dealloc'
9 @end
10
11 @interface MyObject : NSObject {}
12 @property(assign) id myproperty;
13 @end
14
15 @implementation MyObject // warn: does not send 'dealloc' to super
16 - (void)dealloc {
17 self.myproperty = 0;
18 }
19 @end
20
21 @interface MyObject : NSObject {
22 id _myproperty;
23 }
24 @property(retain) id myproperty;
25 @end
26
27 @implementation MyObject
28 @synthesize myproperty = _myproperty;
29 // warn: var was retained but wasn't released
30 - (void)dealloc {
31 [super dealloc];
32 }
33 @end
34
35 @interface MyObject : NSObject {
36 id _myproperty;
37 }
38 @property(assign) id myproperty;
39 @end
40
41 @implementation MyObject
42 @synthesize myproperty = _myproperty;
43 // warn: var wasn't retained but was released
44 - (void)dealloc {
45 [_myproperty release];
46 [super dealloc];
47 }
48 @end
49