llvm-project
df0be3ef - [clang-tidy] Add SARIF output to clang-tidy (#219182)

Commit
2 days ago
[clang-tidy] Add SARIF output to clang-tidy (#219182) [clang-tidy] Add SARIF output for clang-tidy diagnostics. Clang-tidy is a static analysis framework, and should therefore be able to output results in the Static Analysis Results Interchange Format (SARIF). This brings clang-tidy in line with clang and clang-static-analyzer. Adds an experimental '--experimental-sarif-export=<file>' option to clang-tidy that writes diagnostics in SARIF format. Each diagnostic is reported as a SARIF result with its check name, severity, and location. Notes are emitted as related locations with their messages, while notes from clang-analyzer checks are emitted as thread flows so the analyzer path can be followed in SARIF viewers. To support this, the shared SARIF writer in clang now skips locations that are invalid or not in a file instead of asserting, allows a message on related locations, and fixes artifact indices not matching their position in the artifacts array. The diagnostic level helpers in SARIFDiagnostic are made public so clang-tidy reports severities consistently with clang. Closes #55647 --------- Co-authored-by: Jones, Matthew (DI SW SIM FRWK PLAT SIMFW HPC) <jones.matthew@siemens.com>
Parents
Loading