MissingDealloc.m revision 26b58cd65f5ae7b90d786b472a0ba527b14637e3
1// RUN: clang -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify
2typedef signed char BOOL;
3@protocol NSObject  - (BOOL)isEqual:(id)object; @end
4@interface NSObject <NSObject> {}
5- (void)dealloc;
6- (id)init;
7@end
8
9typedef struct objc_selector *SEL;
10
11// <rdar://problem/6380411>: 'myproperty' has kind 'assign' and thus the
12//  assignment through the setter does not perform a release.
13
14@interface MyObject : NSObject {
15  id _myproperty;  
16}
17@property(assign) id myproperty;
18@end
19
20@implementation MyObject
21@synthesize myproperty=_myproperty; // no-warning
22- (void)dealloc {
23  self.myproperty = 0;
24  [super dealloc]; 
25}
26@end
27
28//===------------------------------------------------------------------------===
29//  Don't warn about iVars that are selectors.
30
31@interface TestSELs : NSObject {
32  SEL a;
33  SEL b;
34}
35
36@end
37
38@implementation TestSELs // no-warning
39- (id)init {
40  if( (self = [super init]) ) {
41    a = @selector(a);
42    b = @selector(b);
43  }
44
45  return self;
46}
47@end
48
49//===------------------------------------------------------------------------===
50//  Don't warn about iVars that are IBOutlets.
51
52#ifndef IBOutlet
53#define IBOutlet
54#endif
55
56@class NSWindow;
57
58@interface HasOutlet : NSObject {
59IBOutlet NSWindow *window;
60}
61@end
62
63@implementation HasOutlet // no-warning
64@end
65
66