llvm-project/clang/test/CodeGenObjC/direct-method-ret-mismatch.m
Pierre Habouzit 6eb969b7c5 [objc_direct] fix codegen for mismatched Decl/Impl return types
For non direct methods, the codegen uses the type of the Implementation.
Because Objective-C rules allow some differences between the Declaration
and Implementation return types, when the Implementation is in this
translation unit, the type of the Implementation should be preferred to
emit the Function over the Declaration.

Radar-Id: rdar://problem/58797748
Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Differential Revision: https://reviews.llvm.org/D73208
2020-01-30 18:17:45 -08:00

20 lines
475 B
Objective-C

// RUN: %clang_cc1 -emit-llvm -fobjc-arc -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
__attribute__((objc_root_class))
@interface Root
- (Root *)method __attribute__((objc_direct));
@end
@implementation Root
// CHECK-LABEL: define internal i8* @"\01-[Root something]"(
- (id)something {
// CHECK: %{{[^ ]*}} = call {{.*}} @"\01-[Root method]"
return [self method];
}
// CHECK-LABEL: define hidden i8* @"\01-[Root method]"(
- (id)method {
return self;
}
@end