Skip to content

Commit 259afed

Browse files
committed
Change to checking against optionst and check for empty
1 parent b821fc0 commit 259afed

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
245245
options.set_option("trace", true);
246246
}
247247

248+
if(cmdline.isset("export-core-goto"))
249+
options.set_option(
250+
"export-core-goto", cmdline.get_value("export-core-goto"));
251+
248252
if(cmdline.isset("localize-faults"))
249253
options.set_option("localize-faults", true);
250254

@@ -549,15 +553,23 @@ int cbmc_parse_optionst::doit()
549553
// At this point, our goto-model should be in core-goto form (all of the
550554
// transformations have been run and the program is ready to be given to the
551555
// solver).
552-
if(cmdline.isset("export-core-goto"))
556+
if(options.is_set("export-core-goto"))
553557
{
554-
auto core_goto_filename = cmdline.get_value("export-core-goto");
558+
auto core_goto_filename = options.get_option("export-core-goto");
559+
if(core_goto_filename.empty())
560+
{
561+
log.error()
562+
<< "ERROR: Please provide a filename to write the goto-binary to."
563+
<< messaget::eom;
564+
return CPROVER_EXIT_INTERNAL_ERROR;
565+
}
566+
555567
auto success =
556568
!write_goto_binary(core_goto_filename, goto_model, ui_message_handler);
557569

558570
if(!success)
559571
{
560-
log.error() << "Unable to export goto-program in file "
572+
log.error() << "ERROR: Unable to export goto-program in file "
561573
<< core_goto_filename << messaget::eom;
562574
return CPROVER_EXIT_INTERNAL_ERROR;
563575
}

0 commit comments

Comments
 (0)