Skip to content

Commit cde4534

Browse files
committed
[TBD] Add initializers AFPs to TBD.
Previously, the async function pointers for initializers were omitted from TBD files. That resulted in a mismatch between the symbols exported from the IR module and those listed in the TBDS. Here, that is corrected. As with regular function pointers, the symbols for the async function pointers for initializers need to be manually added just as the symbols for initializers themselves need to be manually added. rdar://82045176
1 parent 71c0eae commit cde4534

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/TBDGen/TBDGen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,10 @@ void TBDGenVisitor::visitConstructorDecl(ConstructorDecl *CD) {
988988
// default ValueDecl handling gives the allocating one, so we have to
989989
// manually include the non-allocating one.
990990
addSymbol(SILDeclRef(CD, SILDeclRef::Kind::Initializer));
991+
if (CD->hasAsync()) {
992+
addAsyncFunctionPointerSymbol(
993+
SILDeclRef(CD, SILDeclRef::Kind::Initializer));
994+
}
991995
if (auto parentClass = CD->getParent()->getSelfClassDecl()) {
992996
if (parentClass->isObjC() || CD->isObjC())
993997
recorder.addObjCMethod(parentClass, SILDeclRef(CD));

test/TBD/rdar82045176.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift-dylib(%t/%target-library-name(first)) %s -emit-module -module-name thing -emit-tbd -enable-testing -Xfrontend -disable-availability-checking -Xfrontend -validate-tbd-against-ir=all
3+
4+
class Test {
5+
init() async { }
6+
}

0 commit comments

Comments
 (0)