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
20 lines
475 B
Objective-C
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
|