Skip to content

SILGen: Don't stub unavailable raw value initializers for clang enums #68953

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Oct 3, 2023

We must be conservative when generating SIL for raw value initializers of clang enums and not insert an unavailable code reached trap, even if the enum is technically unavailable. It appears that there is a long-standing loophole that allows a clang module to typedef an unavailable type in order to make that type available in Swift even though the underlying type is declared to be unavailable in Swift. This loophole is load-bearing for some existing Swift overlays.

Resolves rdar://116378269

@tshortli tshortli requested a review from beccadax October 3, 2023 22:09
We must be conservative when generating SIL for raw value initializers of clang
enums and not insert an unavailable code reached trap, even if the enum is
technically unavailable. It appears that there is a long-standing loophole that
allows a clang module to typedef an unavailable type in order to make that type
available in Swift even though the underlying type is declared to be
unavailable in Swift. This loophole is load-bearing for some existing Swift
overlays.

Resolves rdar://116378269
@tshortli tshortli force-pushed the no-unavailable-stub-for-clang-enums branch from 37354e1 to fddf6ce Compare October 4, 2023 01:07
@tshortli
Copy link
Contributor Author

tshortli commented Oct 4, 2023

@swift-ci please smoke test

@tshortli tshortli merged commit 69e817c into swiftlang:main Oct 4, 2023
@tshortli tshortli deleted the no-unavailable-stub-for-clang-enums branch October 4, 2023 05:16
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.

1 participant