[clang-tools-extra] Allow to pass config file to clang-tidy-diff (PR #75457)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 02:34:21 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tidy

Author: Michael Lettrich (MichaelLettrich)

<details>
<summary>Changes</summary>

    Adds a `-config-file` command line option that passes on the path of .`clang-tidy` or custom config file to the `clang-tidy` executable.

---
Full diff: https://github.com/llvm/llvm-project/pull/75457.diff


1 Files Affected:

- (modified) clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py (+4) 


``````````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..53c990f58a7edc 100755
--- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
@@ -173,6 +173,8 @@ def main():
         help="checks filter, when not specified, use clang-tidy " "default",
         default="",
     )
+    parser.add_argument("-config-file", dest="config_file",
+        help="Specify the path of .clang-tidy or custom config file",default="")
     parser.add_argument("-use-color", action="store_true", help="Use colors in output")
     parser.add_argument(
         "-path", dest="build_path", help="Path used to read a compile command database."
@@ -313,6 +315,8 @@ def main():
         common_clang_tidy_args.append("-fix")
     if args.checks != "":
         common_clang_tidy_args.append("-checks=" + args.checks)
+    if args.config_file != "":
+        common_clang_tidy_args.append("-config-file=" + args.config_file)
     if args.quiet:
         common_clang_tidy_args.append("-quiet")
     if args.build_path is not None:

``````````

</details>


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


More information about the cfe-commits mailing list