reduce-clang-crash.py: Use creduce if cvise is not found (#177413)

See discussion on #128592.
This commit is contained in:
Nico Weber
2026-01-22 13:16:50 -05:00
committed by GitHub
parent 84db4da288
commit 73549e6046

View File

@@ -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])