[clang-tools-extra] Add ability to pass in a clang-tidy config file to clang-tidy-diff (PR #75721)
Chris Apple via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 16 15:56:23 PST 2023
https://github.com/cjappl created https://github.com/llvm/llvm-project/pull/75721
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`
>From 433f4ac919a6967c278e56a19b5824e474ebd907 Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Sat, 16 Dec 2023 15:53:56 -0800
Subject: [PATCH] Add ability to pass in a clang-tidy config file to
clang-tidy-diff
---
clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 8 ++++++++
1 file changed, 8 insertions(+)
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 != "":
More information about the cfe-commits
mailing list