xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/dealloc.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wdealloc-in-category -verify %s
2*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wdealloc-in-category -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3f4a2713aSLionel Sambuc// rdar://11987838
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc@protocol NSObject
6f4a2713aSLionel Sambuc- dealloc; // expected-error {{return type must be correctly specified as 'void' under ARC, instead of 'id'}}
7f4a2713aSLionel Sambuc// CHECK: fix-it:"{{.*}}":{6:3-6:3}:"(void)"
8f4a2713aSLionel Sambuc@end
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc@protocol Foo <NSObject> @end
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc@interface Root <Foo>
13f4a2713aSLionel Sambuc@end
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc@interface Baz : Root {
16f4a2713aSLionel Sambuc}
17f4a2713aSLionel Sambuc@end
18f4a2713aSLionel Sambuc
19f4a2713aSLionel Sambuc@implementation Baz
20f4a2713aSLionel Sambuc-  (id) dealloc { // expected-error {{return type must be correctly specified as 'void' under ARC, instead of 'id'}}
21f4a2713aSLionel Sambuc// CHECK: fix-it:"{{.*}}":{20:5-20:7}:"void"
22f4a2713aSLionel Sambuc}
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc@end
25f4a2713aSLionel Sambuc
26*0a6a1f1dSLionel Sambuc// rdar://15397430
27*0a6a1f1dSLionel Sambuc@interface Base
28*0a6a1f1dSLionel Sambuc- (void)dealloc;
29*0a6a1f1dSLionel Sambuc@end
30*0a6a1f1dSLionel Sambuc
31*0a6a1f1dSLionel Sambuc@interface Subclass : Base
32*0a6a1f1dSLionel Sambuc@end
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc@interface Subclass (CAT)
35*0a6a1f1dSLionel Sambuc- (void)dealloc;
36*0a6a1f1dSLionel Sambuc@end
37*0a6a1f1dSLionel Sambuc
38*0a6a1f1dSLionel Sambuc@implementation Subclass (CAT)
39*0a6a1f1dSLionel Sambuc- (void)dealloc { // expected-warning {{-dealloc is being overridden in a category}}
40*0a6a1f1dSLionel Sambuc}
41*0a6a1f1dSLionel Sambuc@end
42*0a6a1f1dSLionel Sambuc
43*0a6a1f1dSLionel Sambuc// rdar://15919775
44*0a6a1f1dSLionel Sambuc@interface NSObject @end
45*0a6a1f1dSLionel Sambuc@interface NSError:NSObject
46*0a6a1f1dSLionel Sambuc@end
47*0a6a1f1dSLionel Sambuc
48*0a6a1f1dSLionel Sambuc@interface NSError(CAT)
49*0a6a1f1dSLionel Sambuc- (NSError *)MCCopyAsPrimaryError __attribute__((objc_method_family(new)));
50*0a6a1f1dSLionel Sambuc@end
51*0a6a1f1dSLionel Sambuc@implementation NSError(CAT)
52*0a6a1f1dSLionel Sambuc- (NSError *)MCCopyAsPrimaryError {
53*0a6a1f1dSLionel Sambuc  return 0;
54*0a6a1f1dSLionel Sambuc}
55*0a6a1f1dSLionel Sambuc@end
56