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 | } |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 11 | - (void)finalize { |
| 12 | // Root class, shouldn't warn |
| 13 | } |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 14 | @end |
| 15 | |
| 16 | @interface Subclass1 : NSObject |
| 17 | - (void)dealloc; |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 18 | - (void)finalize; |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 19 | @end |
| 20 | |
| 21 | @implementation Subclass1 |
| 22 | - (void)dealloc { |
Ted Kremenek | 4eb14ca | 2011-08-22 19:07:43 +0000 | [diff] [blame] | 23 | } |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 24 | - (void)finalize { |
| 25 | } |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 26 | @end |
| 27 | |
| 28 | @interface Subclass2 : NSObject |
| 29 | - (void)dealloc; |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 30 | - (void)finalize; |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 31 | @end |
| 32 | |
| 33 | @implementation Subclass2 |
| 34 | - (void)dealloc { |
| 35 | [super dealloc]; // Shouldn't warn |
| 36 | } |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 37 | - (void)finalize { |
| 38 | [super finalize]; // Shouldn't warn |
| 39 | } |
Nico Weber | 9a1ecf0 | 2011-08-22 17:25:57 +0000 | [diff] [blame] | 40 | @end |
Ted Kremenek | 4eb14ca | 2011-08-22 19:07:43 +0000 | [diff] [blame] | 41 | |
| 42 | // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 43 | // CHECK: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call |
Ted Kremenek | 8cd8de4 | 2011-09-28 19:32:29 +0000 | [diff] [blame^] | 44 | // CHECK: 1 warning generated. |
| 45 | |
| 46 | // RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s |
| 47 | // CHECK-GC: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call |
| 48 | // CHECK-GC: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call |
| 49 | // CHECK-GC: 2 warnings generated. |
| 50 | |
| 51 | // RUN: %clang_cc1 -fsyntax-only -fobjc-gc-only %s 2>&1 | FileCheck --check-prefix=CHECK-GC-ONLY %s |
| 52 | // CHECK-GC-ONLY: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call |
| 53 | // CHECK-GC-ONLY: 1 warning generated. |
Ted Kremenek | 4eb14ca | 2011-08-22 19:07:43 +0000 | [diff] [blame] | 54 | |
| 55 | // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s |
Nico Weber | 80cb6e6 | 2011-08-28 22:35:17 +0000 | [diff] [blame] | 56 | // CHECK-ARC: warn-missing-super.m:35:4: error: ARC forbids explicit message send of 'dealloc' |
Nico Weber | 27f0776 | 2011-08-29 22:59:14 +0000 | [diff] [blame] | 57 | // CHECK-ARC: 1 error generated. |