Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 1 | @protocol NSCopying @end |
| 2 | |
| 3 | @interface NSObject <NSCopying> |
| 4 | - (void)dealloc; |
| 5 | @end |
| 6 | |
| 7 | @implementation NSObject |
| 8 | - (void)dealloc { |
| 9 | // Root class, shouldn't warn |
| 10 | } |
| 11 | @end |
| 12 | |
| 13 | @interface Subclass1 : NSObject |
| 14 | - (void)dealloc; |
| 15 | @end |
| 16 | |
| 17 | @implementation Subclass1 |
| 18 | - (void)dealloc { |
Ted Kremenek | 4eb14ca | 2011-08-22 19:07:43 +0000 | [diff] [blame^] | 19 | } |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 20 | @end |
| 21 | |
| 22 | @interface Subclass2 : NSObject |
| 23 | - (void)dealloc; |
| 24 | @end |
| 25 | |
| 26 | @implementation Subclass2 |
| 27 | - (void)dealloc { |
| 28 | [super dealloc]; // Shouldn't warn |
| 29 | } |
| 30 | @end |
Ted Kremenek | 4eb14ca | 2011-08-22 19:07:43 +0000 | [diff] [blame^] | 31 | |
| 32 | // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s |
| 33 | // CHECK: warn-missing-super.m:19:1: warning: method possibly missing a [super dealloc] call |
| 34 | // CHECK: 1 warning generated. |
| 35 | |
| 36 | // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s |
| 37 | // CHECK-ARC: warn-missing-super.m:28:4: error: ARC forbids explicit message send of 'dealloc' |
| 38 | // CHECK-ARC: 1 error generated. |