[clang] [clang-tools-extra] [clang-tidy] Add SARIF output to clang-tidy (PR #219182)
Zeyi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 7 05:24:26 PDT 2026
================
@@ -754,7 +773,8 @@ int clangTidyMain(int argc, const char **argv) {
unsigned WErrorCount = 0;
handleErrors(Errors, Context, DisableFixes ? FB_NoFix : Behaviour,
- WErrorCount, BaseFS);
+ WErrorCount, BaseFS, SarifOS.get(),
+ SarifOS && SarifExport == "-");
----------------
zeyi2 wrote:
Thanks for handling the regular text diagnostics when SARIF owns stdout!
Sorry that I missed a similar case before. There is still another output conflict with `--export-fixes=-`:
```cpp
struct A { A(int) {} };
```
```
clang-tidy -checks='-*,google-explicit-constructor' \
-sarif-export=- -export-fixes=- input.cpp -- > output.txt
```
This exits with code 0, but `output.txt` contains both YAML and JSON.
Could we reject this combination before running the checks, or otherwise ensure only one exporter writes to stdout?
https://github.com/llvm/llvm-project/pull/219182
More information about the cfe-commits
mailing list