Files
clang-p2996/clang/test/CodeGenObjC/disable-direct-method.m
Erik Pilkington b660abc80d [ObjC] Add a command line flag that disables recognition of objc_direct for testability
Programmers would like to be able to test direct methods by calling them from a
different linkage unit or mocking them, both of which are impossible. This
patch adds a flag that effectively disables the attribute, which will fix this
when enabled in testable builds. rdar://71190891

Differential revision: https://reviews.llvm.org/D95845
2021-04-06 11:17:01 -04:00

22 lines
557 B
Objective-C

// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10 -fobjc-disable-direct-methods-for-testing %s -o - | FileCheck %s
@interface Y
@property (direct) int direct_property;
@end
@implementation Y @end
// CHECK: @OBJC_PROP_NAME_ATTR_ = private unnamed_addr constant [16 x i8] c"direct_property\00"
// CHECK: @"_OBJC_$_PROP_LIST_Y" =
// CHECK-SAME: @OBJC_PROP_NAME_ATTR_,
@interface X
-(void)m __attribute__((objc_direct));
@end
// CHECK-LABEL: define void @f
void f(X *x) {
[x m];
// CHECK: call void bitcast ({{.*}} @objc_msgSend to {{.*}})
}