diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -105,6 +105,7 @@ line_filter, use_color, plugins, + warnings_as_errors, ): """Gets a command line for clang-tidy.""" start = [clang_tidy_binary] @@ -141,6 +142,8 @@ start.append("-config=" + config) for plugin in plugins: start.append("-load=" + plugin) + if warnings_as_errors: + start.append("--warnings-as-errors=" + warnings_as_errors) start.append(f) return start @@ -224,6 +227,7 @@ args.line_filter, args.use_color, args.plugins, + args.warnings_as_errors, ) proc = subprocess.Popen( @@ -363,6 +367,11 @@ default=[], help="Load the specified plugin in clang-tidy.", ) + parser.add_argument( + "-warnings-as-errors", + default=None, + help="Upgrades warnings to errors. Same format as " "'-checks'", + ) args = parser.parse_args() db_path = "compile_commands.json" @@ -399,6 +408,7 @@ args.line_filter, args.use_color, args.plugins, + args.warnings_as_errors, ) invocation.append("-list-checks") invocation.append("-")