1 | // RUN: %clang_cc1 -Wobjc-multiple-method-names -x objective-c -verify %s |
2 | // RUN: %clang_cc1 -Wobjc-multiple-method-names -x objective-c -verify -fobjc-arc %s |
3 | // expected-no-diagnostics |
4 | |
5 | @interface NSObj |
6 | |
7 | + (instancetype) alloc; |
8 | |
9 | + (_Nonnull instancetype) globalObject; |
10 | |
11 | @end |
12 | |
13 | @interface SelfAllocReturn: NSObj |
14 | |
15 | - (instancetype)initWithFoo:(int)x; |
16 | |
17 | @end |
18 | |
19 | @interface SelfAllocReturn2: NSObj |
20 | |
21 | - (instancetype)initWithFoo:(SelfAllocReturn *)x; |
22 | |
23 | @end |
24 | |
25 | @implementation SelfAllocReturn |
26 | |
27 | - (instancetype)initWithFoo:(int)x { |
28 | return self; |
29 | } |
30 | |
31 | + (instancetype) thingWithFoo:(int)x { |
32 | return [[self alloc] initWithFoo: x]; |
33 | } |
34 | |
35 | + (void) initGlobal { |
36 | (void)[[self globalObject] initWithFoo: 20]; |
37 | } |
38 | |
39 | @end |
40 | |