[clang-tools-extra] Add ability to pass in a clang-tidy config file to clang-tidy-diff (PR #75721)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 16 15:57:05 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: Chris Apple (cjappl)
<details>
<summary>Changes</summary>
I found this handy for situations where you want to pass in a config file and not rely on a default `.clang-tidy` file.
The new option is `-config` and will expect something that can be passed into the `--config-file=` parameter of `clang-tidy`
---
Full diff: https://github.com/llvm/llvm-project/pull/75721.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py (+8)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
index 8817e2914f6e25..fdaf1a4330e060 100755
--- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
@@ -223,6 +223,12 @@ def main():
default=[],
help="Load the specified plugin in clang-tidy.",
)
+ parser.add_argument(
+ "-config",
+ dest="config",
+ default=None,
+ help="Specifies a clang-tidy config file"
+ )
clang_tidy_args = []
argv = sys.argv[1:]
@@ -309,6 +315,8 @@ def main():
# Form the common args list.
common_clang_tidy_args = []
+ if args.config is not None:
+ common_clang_tidy_args.append("--config-file=" + args.config)
if args.fix:
common_clang_tidy_args.append("-fix")
if args.checks != "":
``````````
</details>
https://github.com/llvm/llvm-project/pull/75721
More information about the cfe-commits
mailing list