59 lines · plain
1@protocol NSCopying @end2 3__attribute__((objc_root_class))4@interface NSObject <NSCopying>5- (void)dealloc;6@end7 8@implementation NSObject9- (void)dealloc {10 // Root class, shouldn't warn11}12- (void)finalize {13 // Root class, shouldn't warn14}15@end16 17@interface Subclass1 : NSObject18- (void)dealloc;19- (void)finalize;20@end21 22@implementation Subclass123- (void)dealloc {24}25- (void)finalize {26}27@end28 29@interface Subclass2 : NSObject30- (void)dealloc;31- (void)finalize;32@end33 34@implementation Subclass235- (void)dealloc {36 [super dealloc]; // Shouldn't warn37}38- (void)finalize {39 [super finalize]; // Shouldn't warn40}41@end42 43// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s44// CHECK: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call45// CHECK: 1 warning generated.46 47// RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s48// CHECK-GC: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call49// CHECK-GC: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call50// CHECK-GC: 2 warnings generated.51 52// RUN: %clang_cc1 -fsyntax-only -fobjc-gc-only %s 2>&1 | FileCheck --check-prefix=CHECK-GC-ONLY %s53// CHECK-GC-ONLY: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call54// CHECK-GC-ONLY: 1 warning generated.55 56// RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s57// CHECK-ARC: warn-missing-super.m:36:10: error: ARC forbids explicit message send of 'dealloc'58// CHECK-ARC: 1 error generated.59