llvm-project/clang/test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
Juneyoung Lee f193bcc701 Revert D105169 due to the two-stage failure in ASAN
This reverts the following commits:
37ca7a795b277c20c02a218bf44052278c03344b
9aa6c72b92b6c89cc6d23b693257df9af7de2d15
705387c5074bcca36d626882462ebbc2bcc3bed4
8ca4b3ef19fe82d7ad6a6e1515317dcc01b41515
80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a
2021-10-18 23:52:46 +09:00

44 lines
1.6 KiB
Plaintext

// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -emit-llvm -disable-llvm-passes -O3 -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
void test0(id x) {
extern void test0_helper(id (^)(void));
test0_helper([=]() { return x; });
// CHECK-LABEL: define internal i8* @___Z5test0P11objc_object_block_invoke
// CHECK: [[T0:%.*]] = call i8* @"_ZZ5test0P11objc_objectENK3$_0clEv"
// CHECK-NEXT: [[T1:%.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[T0]])
// CHECK-NEXT: [[T2:%.*]] = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* [[T1]])
// CHECK-NEXT: ret i8* [[T2]]
}
// Check that the delegating block invoke function doesn't destruct the Weak
// object that is passed.
// CHECK-LABEL: define internal void @___Z8testWeakv_block_invoke(
// CHECK: call void @"_ZZ8testWeakvENK3$_2clE4Weak"(
// CHECK-NEXT: ret void
// CHECK-LABEL: define internal void @"_ZZ8testWeakvENK3$_2clE4Weak"(
// CHECK: call void @_ZN4WeakD1Ev(
// CHECK-NEXT: ret void
id test1_rv;
void test1() {
extern void test1_helper(id (*)(void));
test1_helper([](){ return test1_rv; });
// CHECK-LABEL: define internal i8* @"_ZZ5test1vEN3$_18__invokeEv"
// CHECK: [[T0:%.*]] = call i8* @"_ZZ5test1vENK3$_1clEv"
// CHECK-NEXT: [[T1:%.*]] = notail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* [[T0]])
// CHECK-NEXT: [[T2:%.*]] = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* [[T1]])
// CHECK-NEXT: ret i8* [[T2]]
}
struct Weak {
__weak id x;
};
void testWeak() {
extern void testWeak_helper(void (^)(Weak));
testWeak_helper([](Weak){});
}