Skip to content

Commit 4a515c6

Browse files
committed
[TBDGen] @asyncHandlers don't have public async function pointers.
Previously, an async function pointer symbol was being emitted into the TBD for all AbstractFunctionDecls which returned true for "hasAsynContext", i.e. both those that were async and those which were asnycHandlers. That was not correct because the async function portion of an asyncHandler is not ABI. Here, that mistake is fixed by only emitting this symbol for functions which are annotated async (i.e. those for which "hasAsync" returns true). rdar://problem/72329062
1 parent 84e7ba7 commit 4a515c6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/TBDGen/TBDGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ void TBDGenVisitor::visitAbstractFunctionDecl(AbstractFunctionDecl *AFD) {
721721

722722
visitDefaultArguments(AFD, AFD->getParameters());
723723

724-
if (AFD->isAsyncContext()) {
724+
if (AFD->hasAsync()) {
725725
addSymbol(LinkEntity::forAsyncFunctionPointer(AFD));
726726
}
727727
}

test/TBD/async-function-pointer.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// REQUIRES: VENDOR=apple
2+
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-concurrency -validate-tbd-against-ir=all -module-name test | %FileCheck %s
3+
4+
// CHECK: @"$s4test6testityyYFAD" = hidden global %swift.async_func_pointer
5+
6+
@asyncHandler
7+
public func testit() { }

0 commit comments

Comments
 (0)