Skip to content

Turn pretty-printing of a declaration into a request #76813

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 2, 2024

Conversation

DougGregor
Copy link
Member

The diagnostics engine has some code to pretty-print a declaration when there is no source location for that declaration. The declaration is pretty-printed into a source buffer, and a source location into that buffer is synthesizes. This applies to synthesized declarations as well as those imported from Swift modules (without source code) or from Clang.

Reimplement this pretty-printing for declarations as a request. In doing so, change the manner in which we do the printing: the diagnostics engine printed the entire enclosing type into a buffer whose name was the module + that type. This meant that the buffer was shared by every member of that type, but also meant that we would end up deserializing a lot of declarations just for printing and potentially doing a lot more work for these diagnostics.

The diagnostics engine has some code to pretty-print a declaration when
there is no source location for that declaration. The declaration is
pretty-printed into a source buffer, and a source location into that
buffer is synthesizes. This applies to synthesized declarations as well
as those imported from Swift modules (without source code) or from Clang.

Reimplement this pretty-printing for declarations as a request. In
doing so, change the manner in which we do the printing: the
diagnostics engine printed the entire enclosing type into a buffer
whose name was the module + that type. This meant that the buffer was
shared by every member of that type, but also meant that we would end
up deserializing a lot of declarations just for printing and
potentially doing a lot more work for these diagnostics.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge October 1, 2024 22:55
@DougGregor DougGregor merged commit 90e2b60 into swiftlang:main Oct 2, 2024
3 checks passed
@DougGregor DougGregor deleted the pretty-print-decl-request branch October 2, 2024 16:51
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