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