[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaObjC / multiple-method-names-in-class-self.m
blob47e1306d3837049572ac7c064c1e40da77aad400
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
5 @interface NSObj
7 + (instancetype) alloc;
9 + (_Nonnull instancetype) globalObject;
11 @end
13 @interface SelfAllocReturn: NSObj
15 - (instancetype)initWithFoo:(int)x;
17 @end
19 @interface SelfAllocReturn2: NSObj
21 - (instancetype)initWithFoo:(SelfAllocReturn *)x;
23 @end
25 @implementation SelfAllocReturn
27 - (instancetype)initWithFoo:(int)x {
28     return self;
31 + (instancetype) thingWithFoo:(int)x {
32     return [[self alloc] initWithFoo: x];
35 + (void) initGlobal {
36   (void)[[self globalObject] initWithFoo: 20];
39 @end