[llvm-branch-commits] [clang-tools-extra] release/20.x: [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (#137286) (PR #137775)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 29 02:23:02 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport 014ab736dc741f24c007f9861e24b31faba0e1e7
Requested by: @<!-- -->carlosgalvezp
---
Full diff: https://github.com/llvm/llvm-project/pull/137775.diff
2 Files Affected:
- (modified) clang-tools-extra/clang-tidy/tool/run-clang-tidy.py (+4-3)
- (modified) clang-tools-extra/docs/ReleaseNotes.rst (+3)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index f1b934f7139e9..8741147a4f8a3 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -87,7 +87,7 @@ def find_compilation_database(path: str) -> str:
def get_tidy_invocation(
- f: str,
+ f: Optional[str],
clang_tidy_binary: str,
checks: str,
tmpdir: Optional[str],
@@ -147,7 +147,8 @@ def get_tidy_invocation(
start.append(f"--warnings-as-errors={warnings_as_errors}")
if allow_no_checks:
start.append("--allow-no-checks")
- start.append(f)
+ if f:
+ start.append(f)
return start
@@ -490,7 +491,7 @@ async def main() -> None:
try:
invocation = get_tidy_invocation(
- "",
+ None,
clang_tidy_binary,
args.checks,
None,
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 2ab597eb37048..0b2e9c5fabc36 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -190,6 +190,9 @@ Improvements to clang-tidy
- Fixed bug in :program:`clang-tidy` by which `HeaderFilterRegex` did not take
effect when passed via the `.clang-tidy` file.
+- Fixed bug in :program:`run_clang_tidy.py` where the program would not
+ correctly display the checks enabled by the top-level `.clang-tidy` file.
+
New checks
^^^^^^^^^^
``````````
</details>
https://github.com/llvm/llvm-project/pull/137775
More information about the llvm-branch-commits
mailing list