Skip to content

[Diagnostics] Emit generated code buffers into diagnostic files. #62861

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

DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 5, 2023

Extend the serialized diagnostics file format to also support providing the contents of source files, which can include a reference to the "original source range" whose text is conceptually replaced with the contents of the serialized diagnostics file, e.g., due to macro expansion.

Implements the Swift side of rdar://103900370

Extend the serialized diagnostics file format to also support providing
the contents of source files, which can include a reference to the
"original source range" whose text is conceptually replaced with the
contents of the serialized diagnostics file, e.g., due to macro
expansion.
@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please build toolchain

When emitting generated source file buffers, we could end up
reallocating the DenseMap that tracks file IDs while still holding a
reference to it. Hilarity ensues. Stop that hilarity by taking a copy.

Additionally, make sure we don't emit an invalid source range, and
instead put in empty source locations.
File IDs have been expressed using a 10-bit fixed field. This limits us
to 1023 different files in which we can emit diagnostics, where
overflowing would simply crash. With the introduction of macros and
their generated source buffers, we're much more likely to overflow.

Switch to a 5-bit VBR field, which is slightly smaller for the common
case where there are few files involving diagnositcs, and which also
allows us to have up to 2^32-1 file IDs.
@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please build toolchain

@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

swiftlang/llvm-project#5901

@swift-ci please build toolchain

@DougGregor DougGregor merged commit 973b0ce into swiftlang:main Jan 6, 2023
@DougGregor DougGregor deleted the serialized-diag-source-file-buffers branch January 6, 2023 18:03
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