Skip to content

Commit 2a888e5

Browse files
Merge pull request swiftlang#35442 from nate-chandler/rdar73026036
[Async CC] Handle dynamic functions.
2 parents 9a93a3b + 130c518 commit 2a888e5

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,8 @@ void IRGenModule::createReplaceableProlog(IRGenFunction &IGF, SILFunction *f) {
26042604
auto authInfo = PointerAuthInfo::emit(IGF, schema, fnPtrAddr, authEntity);
26052605

26062606
auto *Res = IGF.Builder.CreateCall(
2607-
FunctionPointer(silFunctionType, realReplFn, authInfo, signature),
2607+
FunctionPointer(silFunctionType, realReplFn, authInfo, signature)
2608+
.getAsFunction(IGF),
26082609
forwardedArgs);
26092610
Res->setTailCall();
26102611
if (IGF.CurFn->getReturnType()->isVoidTy())
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -emit-ir | %FileCheck %s --check-prefix=CHECK-LL
3+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -module-name main -o %t/main %target-rpath(%t)
4+
// RUN: %target-codesign %t/main
5+
// RUN: %target-run %t/main | %FileCheck %s
6+
7+
// REQUIRES: executable_test
8+
// REQUIRES: swift_test_mode_optimize_none
9+
// REQUIRES: concurrency
10+
// UNSUPPORTED: use_os_stdlib
11+
12+
import _Concurrency
13+
14+
15+
// CHECK: running
16+
17+
// CHECK-LL: @"$s4mainyyYcfU_Tu" = internal global %swift.async_func_pointer
18+
19+
// CHECK-LL: define hidden swiftcc void @"$s4main3runyyYF"(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* {{%[0-9]+}}) {{#[0-9]*}} {
20+
dynamic func run() async {
21+
print("running")
22+
}
23+
24+
runAsyncAndBlock {
25+
await run()
26+
}

0 commit comments

Comments
 (0)