| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wdealloc-in-category -verify %s |
| 2 |
// 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 |
| 3 |
|
| 4 |
@protocol NSObject |
| 5 |
- dealloc; // expected-error {{return type must be correctly specified as 'void' under ARC, instead of 'id'}} |
| 6 |
// CHECK: fix-it:"{{.*}}":{5:3-5:3}:"(void)" |
| 7 |
@end |
| 8 |
|
| 9 |
@protocol Foo <NSObject> @end |
| 10 |
|
| 11 |
@interface Root <Foo> |
| 12 |
@end |
| 13 |
|
| 14 |
@interface Baz : Root { |
| 15 |
} |
| 16 |
@end |
| 17 |
|
| 18 |
@implementation Baz |
| 19 |
- (id) dealloc { // expected-error {{return type must be correctly specified as 'void' under ARC, instead of 'id'}} |
| 20 |
// CHECK: fix-it:"{{.*}}":{19:5-19:7}:"void" |
| 21 |
} |
| 22 |
|
| 23 |
@end |
| 24 |
|
| 25 |
@interface Base |
| 26 |
- (void)dealloc; |
| 27 |
@end |
| 28 |
|
| 29 |
@interface Subclass : Base |
| 30 |
@end |
| 31 |
|
| 32 |
@interface Subclass (CAT) |
| 33 |
- (void)dealloc; |
| 34 |
@end |
| 35 |
|
| 36 |
@implementation Subclass (CAT) |
| 37 |
- (void)dealloc { // expected-warning {{-dealloc is being overridden in a category}} |
| 38 |
} |
| 39 |
@end |
| 40 |
|
| 41 |
@interface NSObject @end |
| 42 |
@interface NSError:NSObject |
| 43 |
@end |
| 44 |
|
| 45 |
@interface NSError(CAT) |
| 46 |
- (NSError *)MCCopyAsPrimaryError __attribute__((objc_method_family(new))); |
| 47 |
@end |
| 48 |
@implementation NSError(CAT) |
| 49 |
- (NSError *)MCCopyAsPrimaryError { |
| 50 |
return 0; |
| 51 |
} |
| 52 |
@end |