https://github.com/nico created https://github.com/llvm/llvm-project/pull/177413

See discussion on #128592.

>From 39998bd2686b248c87c23160d31b7613acb717cd Mon Sep 17 00:00:00 2001
From: Nico Weber <[email protected]>
Date: Thu, 22 Jan 2026 12:51:21 -0500
Subject: [PATCH] reduce-clang-crash.py: Use creduce if cvise is not found

See discussion on #128592.
---
 clang/utils/reduce-clang-crash.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/clang/utils/reduce-clang-crash.py 
b/clang/utils/reduce-clang-crash.py
index 22e3dbb8f9b3f..075ff91af2f5a 100755
--- a/clang/utils/reduce-clang-crash.py
+++ b/clang/utils/reduce-clang-crash.py
@@ -38,7 +38,7 @@ def check_file(fname):
     return fname
 
 
-def check_cmd(cmd_name, cmd_dir, cmd_path=None):
+def check_cmd(cmd_name, cmd_dir, cmd_path=None, 
return_none_if_not_found=False):
     """
     Returns absolute path to cmd_path if it is given,
     or absolute path to cmd_dir/cmd_name.
@@ -55,6 +55,9 @@ def check_cmd(cmd_name, cmd_dir, cmd_path=None):
     if cmd:
         return cmd
 
+    if return_none_if_not_found:
+        return None
+
     if not cmd_dir:
         cmd_dir = "$PATH"
     sys.exit("ERROR: `%s` not found in %s" % (cmd_name, cmd_dir))
@@ -461,8 +464,9 @@ def main():
     args, creduce_flags = parser.parse_known_args()
     verbose = args.verbose
     llvm_bin = os.path.abspath(args.llvm_bin) if args.llvm_bin else None
-    creduce_cmd = check_cmd("creduce", None, args.creduce)
-    creduce_cmd = check_cmd("cvise", None, args.creduce)
+    creduce_cmd = check_cmd("cvise", None, args.creduce, 
return_none_if_not_found=True)
+    if not creduce_cmd:
+        creduce_cmd = check_cmd("creduce", None, args.creduce)
     clang_cmd = check_cmd("clang", llvm_bin, args.clang)
 
     crash_script = check_file(args.crash_script[0])

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to