Skip to content

process_wrapper: Convert non-JSON diagnostics from LLVM to JSON. #3309

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
Mar 5, 2025

Conversation

martinboehme
Copy link
Collaborator

Even when rustc is run with --error-format=json, LLVM may still output
human-readable diagnostics

that are not formatted as JSON. So far, process_wrapper has choked on these.

This patch detects these lines and converts them to JSON so that they can be
processed like JSON diagnostics from rustc itself.

The correct fundamental fix would likely be to teach rustc itself to perform
this conversion, but this is a change that would require some time to implement,
so we're putting this fix in place instead.

Even when rustc is run with `--error-format=json`, LLVM may still [output
human-readable diagnostics](https://github.com/llvm/llvm-project/blob/680391f07a45272bb9bfd385cf4c6846b8be32dd/llvm/lib/MC/MCSubtargetInfo.cpp#L82)
that are not formatted as JSON. So far, process_wrapper has choked on these.

This patch detects these lines and converts them to JSON so that they can be
processed like JSON diagnostics from rustc itself.

The correct fundamental fix would likely be to teach rustc itself to perform
this conversion, but this is a change that would require some time to implement,
so we're putting this fix in place instead.
Copy link
Collaborator

@krasimirgg krasimirgg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@krasimirgg krasimirgg added this pull request to the merge queue Mar 5, 2025
Merged via the queue into bazelbuild:main with commit 13c596e Mar 5, 2025
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