Skip to content

Commit 057d623

Browse files
committed
[clang-tidy] Add an option to treat warnings as errors
This patch allows to treat warnings as erros using clang-tidy-diff.
1 parent b11e1ba commit 057d623

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ def main():
259259
action="store_true",
260260
help="Only check files in the compilation database",
261261
)
262+
parser.add_argument(
263+
"-warnings-as-errors",
264+
help="Upgrades clang-tidy warnings to errors. Same format as '-checks'.",
265+
default="",
266+
)
262267

263268
clang_tidy_args = []
264269
argv = sys.argv[1:]
@@ -374,6 +379,8 @@ def main():
374379
common_clang_tidy_args.append("-extra-arg-before=%s" % arg)
375380
for plugin in args.plugins:
376381
common_clang_tidy_args.append("-load=%s" % plugin)
382+
if args.warnings_as_errors != "":
383+
common_clang_tidy_args.append("-warnings-as-errors=" + args.warnings_as_errors)
377384

378385
for name in lines_by_file:
379386
line_filter_json = json.dumps(

0 commit comments

Comments
 (0)