xref: /llvm-project/clang/test/SemaObjC/warn-explicit-call-initialize.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1  -fsyntax-only  -triple x86_64-apple-darwin10 -verify %s
2
3@interface NSObject
4+ (void)initialize; // expected-note 2 {{method 'initialize' declared here}}
5@end
6
7@interface I : NSObject
8+ (void)initialize; // expected-note {{method 'initialize' declared here}}
9+ (void)SomeRandomMethod;
10@end
11
12@implementation I
13- (void) Meth {
14  [I initialize];     // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
15  [NSObject initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
16}
17+ (void)initialize {
18  [super initialize];
19}
20+ (void)SomeRandomMethod { // expected-note {{method 'SomeRandomMethod' declared here}}
21  [super initialize]; // expected-warning {{explicit call to [super initialize] should only be in implementation of +initialize}}
22}
23@end
24
25