xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/warn-missing-super.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc@protocol NSCopying @end
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc__attribute__((objc_root_class))
4*f4a2713aSLionel Sambuc@interface NSObject <NSCopying>
5*f4a2713aSLionel Sambuc- (void)dealloc;
6*f4a2713aSLionel Sambuc@end
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@implementation NSObject
9*f4a2713aSLionel Sambuc- (void)dealloc {
10*f4a2713aSLionel Sambuc  // Root class, shouldn't warn
11*f4a2713aSLionel Sambuc}
12*f4a2713aSLionel Sambuc- (void)finalize {
13*f4a2713aSLionel Sambuc  // Root class, shouldn't warn
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc@end
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc@interface Subclass1 : NSObject
18*f4a2713aSLionel Sambuc- (void)dealloc;
19*f4a2713aSLionel Sambuc- (void)finalize;
20*f4a2713aSLionel Sambuc@end
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc@implementation Subclass1
23*f4a2713aSLionel Sambuc- (void)dealloc {
24*f4a2713aSLionel Sambuc}
25*f4a2713aSLionel Sambuc- (void)finalize {
26*f4a2713aSLionel Sambuc}
27*f4a2713aSLionel Sambuc@end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc@interface Subclass2 : NSObject
30*f4a2713aSLionel Sambuc- (void)dealloc;
31*f4a2713aSLionel Sambuc- (void)finalize;
32*f4a2713aSLionel Sambuc@end
33*f4a2713aSLionel Sambuc
34*f4a2713aSLionel Sambuc@implementation Subclass2
35*f4a2713aSLionel Sambuc- (void)dealloc {
36*f4a2713aSLionel Sambuc  [super dealloc];  // Shouldn't warn
37*f4a2713aSLionel Sambuc}
38*f4a2713aSLionel Sambuc- (void)finalize {
39*f4a2713aSLionel Sambuc  [super finalize];  // Shouldn't warn
40*f4a2713aSLionel Sambuc}
41*f4a2713aSLionel Sambuc@end
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s
44*f4a2713aSLionel Sambuc// CHECK: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call
45*f4a2713aSLionel Sambuc// CHECK: 1 warning generated.
46*f4a2713aSLionel Sambuc
47*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s
48*f4a2713aSLionel Sambuc// CHECK-GC: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call
49*f4a2713aSLionel Sambuc// CHECK-GC: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call
50*f4a2713aSLionel Sambuc// CHECK-GC: 2 warnings generated.
51*f4a2713aSLionel Sambuc
52*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fobjc-gc-only %s 2>&1 | FileCheck --check-prefix=CHECK-GC-ONLY %s
53*f4a2713aSLionel Sambuc// CHECK-GC-ONLY: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call
54*f4a2713aSLionel Sambuc// CHECK-GC-ONLY: 1 warning generated.
55*f4a2713aSLionel Sambuc
56*f4a2713aSLionel Sambuc// RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
57*f4a2713aSLionel Sambuc// CHECK-ARC: warn-missing-super.m:36:10: error: ARC forbids explicit message send of 'dealloc'
58*f4a2713aSLionel Sambuc// CHECK-ARC: 1 error generated.
59