Fariborz Jahanian | 78e9deb | 2014-08-22 16:57:26 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -verify %s |
| 2 | // rdar://16628028 |
| 3 | |
| 4 | @interface NSObject |
Fariborz Jahanian | 4229228 | 2014-08-25 21:27:38 +0000 | [diff] [blame] | 5 | + (void)initialize; // expected-note 2 {{method 'initialize' declared here}} |
Fariborz Jahanian | 78e9deb | 2014-08-22 16:57:26 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | @interface I : NSObject |
| 9 | + (void)initialize; // expected-note {{method 'initialize' declared here}} |
Fariborz Jahanian | 4229228 | 2014-08-25 21:27:38 +0000 | [diff] [blame] | 10 | + (void)SomeRandomMethod; |
Fariborz Jahanian | 78e9deb | 2014-08-22 16:57:26 +0000 | [diff] [blame] | 11 | @end |
| 12 | |
| 13 | @implementation I |
| 14 | - (void) Meth { |
| 15 | [I initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}} |
| 16 | [NSObject initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}} |
| 17 | } |
Fariborz Jahanian | e8b4550 | 2014-08-22 19:52:49 +0000 | [diff] [blame] | 18 | + (void)initialize { |
| 19 | [super initialize]; |
| 20 | } |
Fariborz Jahanian | 4229228 | 2014-08-25 21:27:38 +0000 | [diff] [blame] | 21 | + (void)SomeRandomMethod { // expected-note {{method 'SomeRandomMethod' declared here}} |
| 22 | [super initialize]; // expected-warning {{explicit call to [super initialize] should only be in implementation of +initialize}} |
| 23 | } |
Fariborz Jahanian | 78e9deb | 2014-08-22 16:57:26 +0000 | [diff] [blame] | 24 | @end |
| 25 | |