Files
Aviral Goel cee7f08ab4 Add -serialize-diagnostics=<format> and the SARIF file type
This PR adds a command-line flag and the supporting types for SARIF as an
alternative to the binary `.dia` format for serializing diagnostics. Nothing
writes a SARIF file yet.

- Adds `-serialize-diagnostics=<format>`, accepting `dia` (the existing binary
format, and the default) or `sarif`. An unknown format is an error. The flag
turns serialization on by itself, so a separate `-serialize-diagnostics` is not
needed.

- Adds a `sarif-diagnostics` file type with a `.sarif` extension, and a matching
supplementary output path next to the existing bitcode one.

- Computes that path when `sarif` is requested, and leaves the `.dia` path empty
in that case, so the compiler only reports the output it will actually write.

- Renames the bitcode path and enum case to `LLVMBitcodeDiagnosticsPath` and
`SerializedFormat::LLVMBitcode`, so that the two formats read as a symmetric
pair rather than implying SARIF is not serialized. This is mechanical, and
accounts for the changes to `Frontend.cpp` and `DiagnosticHelper.cpp`.
`CompilerInvocation::getSerializedDiagnosticsPathForAtMostOnePrimary` keeps its
name: it is bitcode-only by design, since dependency scanning has no SARIF path.

- Adds the three `TY_SARIFDiagnostics` cases the driver's exhaustive switches
require. These are enum bookkeeping only; the driver does not act on the new
format until a later PR.
2026-09-18 09:58:08 -07:00
..
2026-09-15 16:04:21 +01:00
2026-09-15 16:04:21 +01:00
2026-09-15 16:04:21 +01:00
2026-09-15 16:04:21 +01:00