[PATCH] D112008: Add -extra-arg-clang-tidy to {clang-tidy-diff,run-clang-tidy}.py

Xavier Roche via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 18 09:09:40 PDT 2021


Xavier updated this revision to Diff 380436.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112008/new/

https://reviews.llvm.org/D112008

Files:
  clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -81,8 +81,8 @@
 
 def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
                         header_filter, allow_enabling_alpha_checkers,
-                        extra_arg, extra_arg_before, quiet, config,
-                        line_filter):
+                        extra_arg, extra_arg_before, extra_arg_clang_tidy,
+                        quiet, config, line_filter):
   """Gets a command line for clang-tidy."""
   start = [clang_tidy_binary, '--use-color']
   if allow_enabling_alpha_checkers:
@@ -109,6 +109,7 @@
       start.append('-quiet')
   if config:
       start.append('-config=' + config)
+  start += extra_arg_clang_tidy
   start.append(f)
   return start
 
@@ -168,7 +169,8 @@
                                      tmpdir, build_path, args.header_filter,
                                      args.allow_enabling_alpha_checkers,
                                      args.extra_arg, args.extra_arg_before,
-                                     args.quiet, args.config, args.line_filter)
+                                     args.extra_arg_clang_tidy, args.quiet,
+                                     args.config, args.line_filter)
 
     proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     output, err = proc.communicate()
@@ -241,6 +243,9 @@
                       action='append', default=[],
                       help='Additional argument to prepend to the compiler '
                       'command line.')
+  parser.add_argument('-extra-arg-clang-tidy', dest='extra_arg_clang_tidy',
+                      action='append', default=[],
+                      help='Additional argument to use with clang-tidy.')
   parser.add_argument('-quiet', action='store_true',
                       help='Run clang-tidy in quiet mode')
   args = parser.parse_args()
Index: clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
@@ -158,6 +158,9 @@
                       action='append', default=[],
                       help='Additional argument to prepend to the compiler '
                       'command line.')
+  parser.add_argument('-extra-arg-clang-tidy', dest='extra_arg_clang_tidy',
+                      action='append', default=[],
+                      help='Additional argument to use with clang-tidy.')
   parser.add_argument('-quiet', action='store_true', default=False,
                       help='Run clang-tidy in quiet mode')
   clang_tidy_args = []
@@ -233,6 +236,7 @@
     common_clang_tidy_args.append('-extra-arg=%s' % arg)
   for arg in args.extra_arg_before:
     common_clang_tidy_args.append('-extra-arg-before=%s' % arg)
+  common_clang_tidy_args += args.extra_arg_clang_tidy
 
   for name in lines_by_file:
     line_filter_json = json.dumps(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112008.380436.patch
Type: text/x-patch
Size: 3181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211018/2ae2615e/attachment-0001.bin>


More information about the cfe-commits mailing list