Skip to content

Parse: Save and restore InFreestandingMacroArgument when delayed parsing #77210

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 1 commit into from
Oct 25, 2024

Conversation

slavapestov
Copy link
Contributor

Closures appearing in freestanding macro arguments don't have discriminators assigned, since we don't actually emit them.

Similarly we skip recording opaque return types that appear in macro arguments, since they don't get emitted.

However this logic didn't take delayed parsing into account, which must save and restore the InFreestandingMacroArgument bit correctly.

As a result, if the freestanding macro argument contained a closure which contained a local function with a declaration that has an opaque return type, we would crash in serialization from attempting to mangle an opaque return type nested inside of a closure without a discriminator.

Fixes rdar://135445004

Closures appearing in freestanding macro arguments don't have
discriminators assigned, since we don't actually emit them.

Similarly we skip recording opaque return types that appear in macro
arguments, since they don't get emitted.

However this logic didn't take delayed parsing into account, which must
save and restore the InFreestandingMacroArgument bit correctly.

As a result, if the freestanding macro argument contained a closure
which contained a local function with a declaration that has an
opaque return type, we would crash in serialization from attempting
to mangle an opaque return type nested inside of a closure without a
discriminator.

Fixes rdar://135445004
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit c2b8950 into swiftlang:main Oct 25, 2024
3 checks passed
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.

2 participants