[clang-tools-extra] 2499bee - [clang-tidy] run-clang-tidy: forward warnings-as-errors argument
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 12 05:24:28 PDT 2023
Author: indev
Date: 2023-06-12T12:24:08Z
New Revision: 2499beeb5a3d3d2062b14be8ae0f967ef44968ba
URL: https://github.com/llvm/llvm-project/commit/2499beeb5a3d3d2062b14be8ae0f967ef44968ba
DIFF: https://github.com/llvm/llvm-project/commit/2499beeb5a3d3d2062b14be8ae0f967ef44968ba.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index 53dc851149fd7..e0c2d63d2024c 100755
--- 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 @@ def get_tidy_invocation(
line_filter,
use_color,
plugins,
+ warnings_as_errors,
):
"""Gets a command line for clang-tidy."""
start = [clang_tidy_binary]
@@ -141,6 +142,8 @@ def get_tidy_invocation(
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 @@ def run_tidy(args, clang_tidy_binary, tmpdir, build_path, queue, lock, failed_fi
args.line_filter,
args.use_color,
args.plugins,
+ args.warnings_as_errors,
)
proc = subprocess.Popen(
@@ -363,6 +367,11 @@ def main():
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 @@ def main():
args.line_filter,
args.use_color,
args.plugins,
+ args.warnings_as_errors,
)
invocation.append("-list-checks")
invocation.append("-")
More information about the cfe-commits
mailing list