Skip to content

🍒 [5.5] Add Initializers' AFPs #40750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 6, 2022
Merged

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Jan 6, 2022

Description: Previously, the AFPs for initializers were omitted from TBDs. That resulted in a mismatch between the symbols exported from the IR module and the symbols listed in the TBD file. Here that is fixed by adding those symbols to the TBD file. -- This also causes Swift to crash on Linux builds where these assertions are enabled in toolchain builds, causing issues to our Linux adopters.
Risk: Low
Review by: @DougGregor @nate-chandler
Testing: verified manually on reproducer project provided in SR-15659 (reproduced on 5.5.2, and confirmed Swift with this fix (main) does not exhibit the issue)
Original PR: #38918 by @nate-chandler
Radar: https://bugs.swift.org/browse/SR-15659 rdar://86945821 and rdar://82045176

Previously, a LinkEntity for an AST async function pointer was built by
passing an AbstractFunctionDecl.  Later, decl was used to construct a
SILDeclRef.

That arrangement meant that clients could not construct such a
LinkEntity whose SILDeclRef::Kind could not be inferred from the dynamic
type of the decl from which the SILDeclRef was constructed.  In
particular, clients could not construct a LinkEntity for the initializer
corresponding to a ConstructorDecl.

Here, the arrangment is changed so that the LinkEntity for an AST async
function pointer is built by passing a SILDeclRef.
Previously, adding a symbol for an async function pointer to the TBD
entailed passing an AbstractFunctionDecl to
TBDGenVisitor::addAsyncFunctionPointerSymbol.

That arrangment limited clients from specifying a different
SILDeclRef::Kind than the one which could be inferred from the type of
the decl which was passed to the visitor's function.  In particular, it
prevented clients from specifying that the symbol for an initializer
corresponding to a ConstructorDecl should be added to the TBD.

Here, the arrangement is changed so that the visitor's function takes a
SILDeclRef.
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
@ktoso ktoso requested a review from a team as a code owner January 6, 2022 03:05
@ktoso
Copy link
Contributor Author

ktoso commented Jan 6, 2022

@swift-ci please test

@ktoso
Copy link
Contributor Author

ktoso commented Jan 6, 2022

@swift-ci please build toolchain

@swift-ci
Copy link
Contributor

swift-ci commented Jan 6, 2022

Linux Toolchain (Ubuntu 16.04)
Download Toolchain
Git Sha - f506e54

Install command
tar zxf swift-PR-40750-766-ubuntu16.04.tar.gz
More info

@ktoso
Copy link
Contributor Author

ktoso commented Jan 6, 2022

@swift-ci please nominate

@swift-ci
Copy link
Contributor

swift-ci commented Jan 6, 2022

macOS Toolchain
Download Toolchain
Git Sha - f506e54

Install command
tar -zxf swift-PR-40750-1264-osx.tar.gz --directory ~/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants