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,7 +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): + extra_arg, extra_arg_before, quiet, config, + warnings_as_errors): """Gets a command line for clang-tidy.""" start = [clang_tidy_binary] if allow_enabling_alpha_checkers: @@ -106,6 +107,8 @@ start.append('-quiet') if config: start.append('-config=' + config) + if warnings_as_errors: + start.append('-warnings-as-errors=' + warnings_as_errors) start.append(f) return start @@ -165,7 +168,7 @@ tmpdir, build_path, args.header_filter, args.allow_enabling_alpha_checkers, args.extra_arg, args.extra_arg_before, - args.quiet, args.config) + args.quiet, args.config, args.warnings_as_errors) proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = proc.communicate() @@ -234,6 +237,9 @@ 'command line.') parser.add_argument('-quiet', action='store_true', help='Run clang-tidy in quiet mode') + parser.add_argument('-warnings-as-errors', default=None, + help='Upgrades warnings to errors. Does not enable ' + 'any warnings py itself.') args = parser.parse_args() db_path = 'compile_commands.json'