[REQUEST]: Add a mode to support SARIF-based diagnostics
#4.832 aberto em 8 de mar. de 2023
Métricas do repositório
- Stars
- (14.391 estrelas)
- Métricas de merge de PR
- (Mesclagem média 8d 5h) (62 fundiu PRs em 30d)
Description
Is your feature request related to a problem? Please describe
Both Clang and GCC have introduced the ability for diagnostics to be output in SARIF, which offers us the rare opportunity to revolutionise C++ diagnostics. When working with SARIF, the compiler produces a SARIF file, and it is fed to a consumer for pretty rendering. Below are two snippets from Visual Studio Code's Sarif Viewer plugin, when Clang's SARIF mode test output is opened.
It would be fantastic if we could surface SARIF diagnostics in Compiler Explorer.
Describe the solution you'd like
My very naive understanding of Compiler Explorer is that it's Visual Studio Code-based, so I'm hoping that it will be possible for CE to use the Sarif Viewer plugin quite readily. If this isn't the case, then another consumer will either need to be sourced or built.
When in compiler output mode, this should be surfaced via a button in the "Add new" dropdown menu (e.g. "SARIF diagnostics viewer"). When in execution-only mode, perhaps "compiler output" could become a dropdown menu where the options are "Unstructured text" and "SARIF".
To achieve this with the compiler, you'll need to use:
- for GCC:
-fdiagnostics-format=sarif-file - for Clang:
-fdiagnostics-format=sarif-file -fdiagnostics-output-path=<filename>
Note that while Clang can output SARIF to stderr right now, the sarif-file component is still a work-in-progress, and likely won't be ready for another couple of weeks.
Describe alternatives you've considered
I'd actually prefer for SARIF mode to be the default and for unstructured text to be switched to, but I understand that this position is likely in the minority at the moment.
Additional context
Not applicable