[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 16:51:53 PST 2023
https://github.com/cjappl updated https://github.com/llvm/llvm-project/pull/75721
>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 1/3] 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 != "":
>From ff3e289814d8af2c3c8eea12e3ee3c48959aa79a Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Sat, 16 Dec 2023 16:42:28 -0800
Subject: [PATCH 2/3] Fix style
---
clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 fdaf1a4330e060..e20b7a2cda2dde 100755
--- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
@@ -227,7 +227,7 @@ def main():
"-config",
dest="config",
default=None,
- help="Specifies a clang-tidy config file"
+ help="Specifies a clang-tidy config file",
)
clang_tidy_args = []
>From 05ae28f6705a7bccf36bbb3a84a17c3597b44c09 Mon Sep 17 00:00:00 2001
From: Chris Apple <14171107+cjappl at users.noreply.github.com>
Date: Sat, 16 Dec 2023 16:51:41 -0800
Subject: [PATCH 3/3] Update ReleaseNotes
---
clang-tools-extra/docs/ReleaseNotes.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 6d91748e4cef18..0e2679e4fafb0e 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -124,6 +124,10 @@ Improvements to clang-tidy
exporting fixes fails. It now accepts a directory as a value for
`-export-fixes` to export individual yaml files for each compilation unit.
+- Improved :program:`clang-tidy-diff.py` script. It now accepts a `-config` option
+ to pass in a configuration file to :program:`clang-tidy`. This option corresponds
+ to the `--config-file` option in :program:`clang-tidy`.
+
- Improved :program:`run-clang-tidy.py` script. It now accepts a directory
as a value for `-export-fixes` to export individual yaml files for each
compilation unit.
More information about the cfe-commits
mailing list