Skip to content

Commit f506e54

Browse files
nate-chandlerktoso
authored andcommitted
[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 36922aa commit f506e54

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
@@ -999,6 +999,10 @@ void TBDGenVisitor::visitConstructorDecl(ConstructorDecl *CD) {
999999
// default ValueDecl handling gives the allocating one, so we have to
10001000
// manually include the non-allocating one.
10011001
addSymbol(SILDeclRef(CD, SILDeclRef::Kind::Initializer));
1002+
if (CD->hasAsync()) {
1003+
addAsyncFunctionPointerSymbol(
1004+
SILDeclRef(CD, SILDeclRef::Kind::Initializer));
1005+
}
10021006
if (auto parentClass = CD->getParent()->getSelfClassDecl()) {
10031007
if (parentClass->isObjC() || CD->isObjC())
10041008
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)