Ted Kremenek | e0bb804 | 2008-12-08 21:59:21 +0000 | [diff] [blame] | 1 | // RUN: clang -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify |
| 2 | typedef signed char BOOL; |
| 3 | @protocol NSObject - (BOOL)isEqual:(id)object; @end |
| 4 | @interface NSObject <NSObject> {} |
| 5 | - (void)dealloc; |
Ted Kremenek | 63de736 | 2008-12-08 22:01:50 +0000 | [diff] [blame^] | 6 | - (id)init; |
Ted Kremenek | e0bb804 | 2008-12-08 21:59:21 +0000 | [diff] [blame] | 7 | @end |
| 8 | |
Ted Kremenek | 63de736 | 2008-12-08 22:01:50 +0000 | [diff] [blame^] | 9 | typedef struct objc_selector *SEL; |
| 10 | |
Ted Kremenek | e0bb804 | 2008-12-08 21:59:21 +0000 | [diff] [blame] | 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 |
Ted Kremenek | 63de736 | 2008-12-08 22:01:50 +0000 | [diff] [blame^] | 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 |