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( 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()