Skip to content

Commit eed359b

Browse files
Merge pull request #4517 from romainbrenguier/clean-up/goto-analyzer-messaget
goto_analyzer_parse_optionst is not a messaget
2 parents 0ae5255 + 27baa38 commit eed359b

File tree

2 files changed

+41
-48
lines changed

2 files changed

+41
-48
lines changed

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ goto_analyzer_parse_optionst::goto_analyzer_parse_optionst(
7070
int argc,
7171
const char **argv)
7272
: parse_options_baset(GOTO_ANALYSER_OPTIONS, argc, argv, ui_message_handler),
73-
messaget(ui_message_handler),
7473
ui_message_handler(cmdline, std::string("GOTO-ANALYZER ") + CBMC_VERSION)
7574
{
7675
}
@@ -298,7 +297,8 @@ void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
298297
if(!options.get_bool_option("domain set"))
299298
{
300299
// Default to constants as it is light-weight but useful
301-
status() << "Domain not specified, defaulting to --constants" << eom;
300+
log.status() << "Domain not specified, defaulting to --constants"
301+
<< messaget::eom;
302302
options.set_option("constants", true);
303303
}
304304
}
@@ -386,20 +386,20 @@ int goto_analyzer_parse_optionst::doit()
386386

387387
optionst options;
388388
get_command_line_options(options);
389-
eval_verbosity(
389+
messaget::eval_verbosity(
390390
cmdline.get_value("verbosity"), messaget::M_STATISTICS, ui_message_handler);
391391

392392
//
393393
// Print a banner
394394
//
395-
status() << "GOTO-ANALYSER version " << CBMC_VERSION << " "
396-
<< sizeof(void *) * 8 << "-bit " << config.this_architecture() << " "
397-
<< config.this_operating_system() << eom;
395+
log.status() << "GOTO-ANALYSER version " << CBMC_VERSION << " "
396+
<< sizeof(void *) * 8 << "-bit " << config.this_architecture()
397+
<< " " << config.this_operating_system() << messaget::eom;
398398

399399
register_languages();
400400

401401
goto_model =
402-
initialize_goto_model(cmdline.args, get_message_handler(), options);
402+
initialize_goto_model(cmdline.args, log.get_message_handler(), options);
403403

404404
if(process_goto_program(options))
405405
return CPROVER_EXIT_INTERNAL_ERROR;
@@ -423,7 +423,7 @@ int goto_analyzer_parse_optionst::doit()
423423
{
424424
show_goto_functions(
425425
goto_model,
426-
get_message_handler(),
426+
log.get_message_handler(),
427427
get_ui(),
428428
cmdline.isset("list-goto-functions"));
429429
return CPROVER_EXIT_SUCCESS;
@@ -443,15 +443,15 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
443443

444444
if(cmdline.isset("show-taint"))
445445
{
446-
taint_analysis(goto_model, taint_file, get_message_handler(), true, "");
446+
taint_analysis(
447+
goto_model, taint_file, log.get_message_handler(), true, "");
447448
return CPROVER_EXIT_SUCCESS;
448449
}
449450
else
450451
{
451452
std::string json_file=cmdline.get_value("json");
452-
bool result=
453-
taint_analysis(
454-
goto_model, taint_file, get_message_handler(), false, json_file);
453+
bool result = taint_analysis(
454+
goto_model, taint_file, log.get_message_handler(), false, json_file);
455455
return result ? CPROVER_EXIT_VERIFICATION_UNSAFE : CPROVER_EXIT_SUCCESS;
456456
}
457457
}
@@ -471,8 +471,8 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
471471
std::ofstream ofs(json_file);
472472
if(!ofs)
473473
{
474-
error() << "Failed to open json output `"
475-
<< json_file << "'" << eom;
474+
log.error() << "Failed to open json output `" << json_file << "'"
475+
<< messaget::eom;
476476
return CPROVER_EXIT_INTERNAL_ERROR;
477477
}
478478

@@ -496,8 +496,8 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
496496
std::ofstream ofs(json_file);
497497
if(!ofs)
498498
{
499-
error() << "Failed to open json output `"
500-
<< json_file << "'" << eom;
499+
log.error() << "Failed to open json output `" << json_file << "'"
500+
<< messaget::eom;
501501
return CPROVER_EXIT_INTERNAL_ERROR;
502502
}
503503

@@ -521,8 +521,8 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
521521
std::ofstream ofs(json_file);
522522
if(!ofs)
523523
{
524-
error() << "Failed to open json output `"
525-
<< json_file << "'" << eom;
524+
log.error() << "Failed to open json output `" << json_file << "'"
525+
<< messaget::eom;
526526
return CPROVER_EXIT_INTERNAL_ERROR;
527527
}
528528

@@ -553,7 +553,7 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
553553

554554
if(cmdline.isset("show-properties"))
555555
{
556-
show_properties(goto_model, get_message_handler(), get_ui());
556+
show_properties(goto_model, log.get_message_handler(), get_ui());
557557
return CPROVER_EXIT_SUCCESS;
558558
}
559559

@@ -574,29 +574,29 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
574574

575575
if(!out)
576576
{
577-
error() << "Failed to open output file `"
578-
<< outfile << "'" << eom;
577+
log.error() << "Failed to open output file `" << outfile << "'"
578+
<< messaget::eom;
579579
return CPROVER_EXIT_INTERNAL_ERROR;
580580
}
581581

582582
// Build analyzer
583-
status() << "Selecting abstract domain" << eom;
583+
log.status() << "Selecting abstract domain" << messaget::eom;
584584
namespacet ns(goto_model.symbol_table); // Must live as long as the domain.
585585
std::unique_ptr<ai_baset> analyzer(build_analyzer(options, ns));
586586

587587
if(analyzer == nullptr)
588588
{
589-
status() << "Task / Interpreter / Domain combination not supported"
590-
<< messaget::eom;
589+
log.status() << "Task / Interpreter / Domain combination not supported"
590+
<< messaget::eom;
591591
return CPROVER_EXIT_INTERNAL_ERROR;
592592
}
593593

594594
// Run
595-
status() << "Computing abstract states" << eom;
595+
log.status() << "Computing abstract states" << messaget::eom;
596596
(*analyzer)(goto_model);
597597

598598
// Perform the task
599-
status() << "Performing task" << eom;
599+
log.status() << "Performing task" << messaget::eom;
600600

601601
bool result = true;
602602

@@ -607,27 +607,21 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
607607
}
608608
else if(options.get_bool_option("show-on-source"))
609609
{
610-
show_on_source(goto_model, *analyzer, get_message_handler());
610+
show_on_source(goto_model, *analyzer, log.get_message_handler());
611611
return CPROVER_EXIT_SUCCESS;
612612
}
613613
else if(options.get_bool_option("verify"))
614614
{
615-
result = static_verifier(goto_model,
616-
*analyzer,
617-
options,
618-
get_message_handler(),
619-
out);
615+
result = static_verifier(
616+
goto_model, *analyzer, options, log.get_message_handler(), out);
620617
}
621618
else if(options.get_bool_option("simplify"))
622619
{
623620
PRECONDITION(!outfile.empty() && outfile != "-");
624621
output_stream.close();
625622
output_stream.open(outfile, std::ios::binary);
626-
result = static_simplifier(goto_model,
627-
*analyzer,
628-
options,
629-
get_message_handler(),
630-
out);
623+
result = static_simplifier(
624+
goto_model, *analyzer, options, log.get_message_handler(), out);
631625
}
632626
else if(options.get_bool_option("unreachable-instructions"))
633627
{
@@ -652,7 +646,7 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
652646
}
653647
else
654648
{
655-
error() << "Unhandled task" << eom;
649+
log.error() << "Unhandled task" << messaget::eom;
656650
return CPROVER_EXIT_INTERNAL_ERROR;
657651
}
658652

@@ -662,8 +656,8 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)
662656

663657

664658
// Final defensive error case
665-
error() << "no analysis option given -- consider reading --help"
666-
<< eom;
659+
log.error() << "no analysis option given -- consider reading --help"
660+
<< messaget::eom;
667661
return CPROVER_EXIT_USAGE_ERROR;
668662
}
669663

@@ -677,19 +671,20 @@ bool goto_analyzer_parse_optionst::process_goto_program(
677671
remove_asm(goto_model);
678672

679673
// add the library
680-
status() << "Adding CPROVER library (" << config.ansi_c.arch << ")" << eom;
674+
log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")" << messaget::eom;
681675
link_to_library(
682676
goto_model, ui_message_handler, cprover_cpp_library_factory);
683677
link_to_library(goto_model, ui_message_handler, cprover_c_library_factory);
684678
#endif
685679

686680
// remove function pointers
687-
status() << "Removing function pointers and virtual functions" << eom;
681+
log.status() << "Removing function pointers and virtual functions"
682+
<< messaget::eom;
688683
remove_function_pointers(
689-
get_message_handler(), goto_model, cmdline.isset("pointer-check"));
684+
log.get_message_handler(), goto_model, cmdline.isset("pointer-check"));
690685

691686
// do partial inlining
692-
status() << "Partial Inlining" << eom;
687+
log.status() << "Partial Inlining" << messaget::eom;
693688
goto_partial_inline(goto_model, ui_message_handler);
694689

695690
// remove returns, gcc vectors, complex
@@ -699,7 +694,7 @@ bool goto_analyzer_parse_optionst::process_goto_program(
699694

700695
#if 0
701696
// add generic checks
702-
status() << "Generic Property Instrumentation" << eom;
697+
log.status() << "Generic Property Instrumentation" << messaget::eom;
703698
goto_check(options, goto_model);
704699
#else
705700
(void)options; // unused parameter

src/goto-analyzer/goto_analyzer_parse_options.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ class optionst;
153153
OPT_VALIDATE \
154154
// clang-format on
155155

156-
class goto_analyzer_parse_optionst:
157-
public parse_options_baset,
158-
public messaget
156+
class goto_analyzer_parse_optionst: public parse_options_baset
159157
{
160158
public:
161159
virtual int doit() override;

0 commit comments

Comments
 (0)