[clang] [clang-tools-extra] [clang-tidy] Add SARIF output to clang-tidy (PR #219182)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 04:36:06 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE LINT COMMENT: clang-tidy-->


:warning: C/C++ code linter, clang-tidy found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

```bash

git diff -U0 origin/main...HEAD -- clang-tools-extra/clang-tidy/ClangTidy.cpp clang-tools-extra/clang-tidy/ClangTidy.h clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py   -path build -p1 -quiet
```

</details>

<details>
<summary>
View the output from clang-tidy here.
</summary>

```
clang-tools-extra/clang-tidy/ClangTidy.cpp:251:5: warning: variable 'RuleIndexEntryIt' of type 'llvm::StringMap<size_t>::iterator' (aka 'StringMapIterBase<unsigned long, false>') can be declared 'const' [misc-const-correctness]
  251 |     llvm::StringMap<size_t>::iterator RuleIndexEntryIt = RuleIndexEntry.first;
      |     ^
      |                                       const 
clang-tools-extra/clang-tidy/ClangTidy.cpp:252:5: warning: variable 'Inserted' of type 'bool' can be declared 'const' [misc-const-correctness]
  252 |     bool Inserted = RuleIndexEntry.second;
      |     ^
      |          const 
clang-tools-extra/clang-tidy/ClangTidy.cpp:270:19: warning: unchecked access to optional value [bugprone-unchecked-optional-access]
  270 |       RuleIndex = SarifWriter->createRule(Rule);
      |                   ^~~~~~~~~~~
clang-tools-extra/clang-tidy/ClangTidy.cpp:273:5: warning: variable 'Result' of type 'SarifResult' can be declared 'const' [misc-const-correctness]
  273 |     SarifResult Result =
      |     ^
      |                 const 
clang-tools-extra/clang-tidy/ClangTidy.cpp:280:5: warning: unchecked access to optional value [bugprone-unchecked-optional-access]
  280 |     SarifWriter->appendResult(Result);
      |     ^~~~~~~~~~~
clang-tools-extra/clang-tidy/ClangTidy.cpp:381:34: warning: unchecked access to optional value [bugprone-unchecked-optional-access]
  381 |     llvm::json::Value Document = SarifWriter->createDocument();
      |                                  ^~~~~~~~~~~
```

</details>


https://github.com/llvm/llvm-project/pull/219182


More information about the cfe-commits mailing list