Skip to content

Commit 2499bee

Browse files
indev29PiotrZSL
authored andcommitted
[clang-tidy] run-clang-tidy: forward warnings-as-errors argument
Forward `warnings-as-errors` argument to clang-tidy. Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D152625
1 parent 3f31d32 commit 2499bee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def get_tidy_invocation(
105105
line_filter,
106106
use_color,
107107
plugins,
108+
warnings_as_errors,
108109
):
109110
"""Gets a command line for clang-tidy."""
110111
start = [clang_tidy_binary]
@@ -141,6 +142,8 @@ def get_tidy_invocation(
141142
start.append("-config=" + config)
142143
for plugin in plugins:
143144
start.append("-load=" + plugin)
145+
if warnings_as_errors:
146+
start.append("--warnings-as-errors=" + warnings_as_errors)
144147
start.append(f)
145148
return start
146149

@@ -224,6 +227,7 @@ def run_tidy(args, clang_tidy_binary, tmpdir, build_path, queue, lock, failed_fi
224227
args.line_filter,
225228
args.use_color,
226229
args.plugins,
230+
args.warnings_as_errors,
227231
)
228232

229233
proc = subprocess.Popen(
@@ -363,6 +367,11 @@ def main():
363367
default=[],
364368
help="Load the specified plugin in clang-tidy.",
365369
)
370+
parser.add_argument(
371+
"-warnings-as-errors",
372+
default=None,
373+
help="Upgrades warnings to errors. Same format as " "'-checks'",
374+
)
366375
args = parser.parse_args()
367376

368377
db_path = "compile_commands.json"
@@ -399,6 +408,7 @@ def main():
399408
args.line_filter,
400409
args.use_color,
401410
args.plugins,
411+
args.warnings_as_errors,
402412
)
403413
invocation.append("-list-checks")
404414
invocation.append("-")

0 commit comments

Comments
 (0)