Skip to content

Commit 0e212f1

Browse files
janalyzer_parse_options is not a message
In addition this class already inherits a messaget object of type messaget.
1 parent 097a58d commit 0e212f1

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Author: Daniel Kroening, [email protected]
5959

6060
janalyzer_parse_optionst::janalyzer_parse_optionst(int argc, const char **argv)
6161
: parse_options_baset(JANALYZER_OPTIONS, argc, argv, ui_message_handler),
62-
messaget(ui_message_handler),
6362
ui_message_handler(cmdline, std::string("JANALYZER ") + CBMC_VERSION)
6463
{
6564
}
@@ -260,7 +259,7 @@ void janalyzer_parse_optionst::get_command_line_options(optionst &options)
260259
if(!options.get_bool_option("domain set"))
261260
{
262261
// Default to constants as it is light-weight but useful
263-
status() << "Domain not specified, defaulting to --constants" << eom;
262+
log.status() << "Domain not specified, defaulting to --constants" << messaget::eom;
264263
options.set_option("constants", true);
265264
}
266265
}
@@ -343,21 +342,21 @@ int janalyzer_parse_optionst::doit()
343342

344343
optionst options;
345344
get_command_line_options(options);
346-
eval_verbosity(
345+
messaget::eval_verbosity(
347346
cmdline.get_value("verbosity"), messaget::M_STATISTICS, ui_message_handler);
348347

349348
//
350349
// Print a banner
351350
//
352-
status() << "JANALYZER version " << CBMC_VERSION << " " << sizeof(void *) * 8
351+
log.status() << "JANALYZER version " << CBMC_VERSION << " " << sizeof(void *) * 8
353352
<< "-bit " << config.this_architecture() << " "
354-
<< config.this_operating_system() << eom;
353+
<< config.this_operating_system() << messaget::eom;
355354

356355
register_languages();
357356

358357
if(cmdline.args.size() > 1)
359358
{
360-
error() << "Only one .class, .jar or .gbf file should be directly "
359+
log.error() << "Only one .class, .jar or .gbf file should be directly "
361360
"specified on the command-line. To force loading another another class "
362361
"use '--java-load-class somepackage.SomeClass' or "
363362
"'--lazy-methods-extra-entry-point somepackage.SomeClass.method' along "
@@ -367,7 +366,7 @@ int janalyzer_parse_optionst::doit()
367366
}
368367

369368
goto_model =
370-
initialize_goto_model(cmdline.args, get_message_handler(), options);
369+
initialize_goto_model(cmdline.args, log.get_message_handler(), options);
371370

372371
if(process_goto_program(options))
373372
return CPROVER_EXIT_INTERNAL_ERROR;
@@ -386,7 +385,7 @@ int janalyzer_parse_optionst::doit()
386385
{
387386
show_goto_functions(
388387
goto_model,
389-
get_message_handler(),
388+
log.get_message_handler(),
390389
get_ui(),
391390
cmdline.isset("list-goto-functions"));
392391
return CPROVER_EXIT_SUCCESS;
@@ -404,14 +403,14 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
404403

405404
if(cmdline.isset("show-taint"))
406405
{
407-
taint_analysis(goto_model, taint_file, get_message_handler(), true, "");
406+
taint_analysis(goto_model, taint_file, log.get_message_handler(), true, "");
408407
return CPROVER_EXIT_SUCCESS;
409408
}
410409
else
411410
{
412411
std::string json_file = cmdline.get_value("json");
413412
bool result = taint_analysis(
414-
goto_model, taint_file, get_message_handler(), false, json_file);
413+
goto_model, taint_file, log.get_message_handler(), false, json_file);
415414
return result ? CPROVER_EXIT_VERIFICATION_UNSAFE : CPROVER_EXIT_SUCCESS;
416415
}
417416
}
@@ -432,7 +431,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
432431
std::ofstream ofs(json_file);
433432
if(!ofs)
434433
{
435-
error() << "Failed to open json output `" << json_file << "'" << eom;
434+
log.error() << "Failed to open json output `" << json_file << "'" << messaget::eom;
436435
return CPROVER_EXIT_INTERNAL_ERROR;
437436
}
438437

@@ -457,7 +456,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
457456
std::ofstream ofs(json_file);
458457
if(!ofs)
459458
{
460-
error() << "Failed to open json output `" << json_file << "'" << eom;
459+
log.error() << "Failed to open json output `" << json_file << "'" << messaget::eom;
461460
return CPROVER_EXIT_INTERNAL_ERROR;
462461
}
463462

@@ -482,7 +481,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
482481
std::ofstream ofs(json_file);
483482
if(!ofs)
484483
{
485-
error() << "Failed to open json output `" << json_file << "'" << eom;
484+
log.error() << "Failed to open json output `" << json_file << "'" << messaget::eom;
486485
return CPROVER_EXIT_INTERNAL_ERROR;
487486
}
488487

@@ -513,7 +512,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
513512

514513
if(cmdline.isset("show-properties"))
515514
{
516-
show_properties(goto_model, get_message_handler(), get_ui());
515+
show_properties(goto_model, log.get_message_handler(), get_ui());
517516
return CPROVER_EXIT_SUCCESS;
518517
}
519518

@@ -532,28 +531,28 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
532531

533532
if(!out)
534533
{
535-
error() << "Failed to open output file `" << outfile << "'" << eom;
534+
log.error() << "Failed to open output file `" << outfile << "'" << messaget::eom;
536535
return CPROVER_EXIT_INTERNAL_ERROR;
537536
}
538537

539538
// Build analyzer
540-
status() << "Selecting abstract domain" << eom;
539+
log.status() << "Selecting abstract domain" << messaget::eom;
541540
namespacet ns(goto_model.symbol_table); // Must live as long as the domain.
542541
std::unique_ptr<ai_baset> analyzer(build_analyzer(options, ns));
543542

544543
if(analyzer == nullptr)
545544
{
546-
status() << "Task / Interpreter / Domain combination not supported"
545+
log.status() << "Task / Interpreter / Domain combination not supported"
547546
<< messaget::eom;
548547
return CPROVER_EXIT_INTERNAL_ERROR;
549548
}
550549

551550
// Run
552-
status() << "Computing abstract states" << eom;
551+
log.status() << "Computing abstract states" << messaget::eom;
553552
(*analyzer)(goto_model);
554553

555554
// Perform the task
556-
status() << "Performing task" << eom;
555+
log.status() << "Performing task" << messaget::eom;
557556
bool result = true;
558557
if(options.get_bool_option("show"))
559558
{
@@ -563,12 +562,12 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
563562
else if(options.get_bool_option("verify"))
564563
{
565564
result = static_verifier(
566-
goto_model, *analyzer, options, get_message_handler(), out);
565+
goto_model, *analyzer, options, log.get_message_handler(), out);
567566
}
568567
else if(options.get_bool_option("simplify"))
569568
{
570569
result = static_simplifier(
571-
goto_model, *analyzer, options, get_message_handler(), out);
570+
goto_model, *analyzer, options, log.get_message_handler(), out);
572571
}
573572
else if(options.get_bool_option("unreachable-instructions"))
574573
{
@@ -587,7 +586,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
587586
}
588587
else
589588
{
590-
error() << "Unhandled task" << eom;
589+
log.error() << "Unhandled task" << messaget::eom;
591590
return CPROVER_EXIT_INTERNAL_ERROR;
592591
}
593592

@@ -596,7 +595,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
596595
}
597596

598597
// Final defensive error case
599-
error() << "no analysis option given -- consider reading --help" << eom;
598+
log.error() << "no analysis option given -- consider reading --help" << messaget::eom;
600599
return CPROVER_EXIT_USAGE_ERROR;
601600
}
602601

@@ -605,23 +604,23 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
605604
try
606605
{
607606
// remove function pointers
608-
status() << "Removing function pointers and virtual functions" << eom;
607+
log.status() << "Removing function pointers and virtual functions" << messaget::eom;
609608
remove_function_pointers(
610-
get_message_handler(), goto_model, cmdline.isset("pointer-check"));
609+
log.get_message_handler(), goto_model, cmdline.isset("pointer-check"));
611610

612611
// Java virtual functions -> explicit dispatch tables:
613612
remove_virtual_functions(goto_model);
614613

615614
// remove Java throw and catch
616615
// This introduces instanceof, so order is important:
617-
remove_exceptions_using_instanceof(goto_model, get_message_handler());
616+
remove_exceptions_using_instanceof(goto_model, log.get_message_handler());
618617

619618
// Java instanceof -> clsid comparison:
620619
class_hierarchyt class_hierarchy(goto_model.symbol_table);
621-
remove_instanceof(goto_model, class_hierarchy, get_message_handler());
620+
remove_instanceof(goto_model, class_hierarchy, log.get_message_handler());
622621

623622
// do partial inlining
624-
status() << "Partial Inlining" << eom;
623+
log.status() << "Partial Inlining" << messaget::eom;
625624
goto_partial_inline(goto_model, ui_message_handler);
626625

627626
// remove returns, gcc vectors, complex
@@ -630,7 +629,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
630629
remove_complex(goto_model);
631630

632631
// add generic checks
633-
status() << "Generic Property Instrumentation" << eom;
632+
log.status() << "Generic Property Instrumentation" << messaget::eom;
634633
goto_check(options, goto_model);
635634

636635
// recalculate numbers, etc.
@@ -642,13 +641,13 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
642641

643642
catch(const char *e)
644643
{
645-
error() << e << eom;
644+
log.error() << e << messaget::eom;
646645
return true;
647646
}
648647

649648
catch(const std::string &e)
650649
{
651-
error() << e << eom;
650+
log.error() << e << messaget::eom;
652651
return true;
653652
}
654653

@@ -659,7 +658,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
659658

660659
catch(const std::bad_alloc &)
661660
{
662-
error() << "Out of memory" << eom;
661+
log.error() << "Out of memory" << messaget::eom;
663662
return true;
664663
}
665664

jbmc/src/janalyzer/janalyzer_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class optionst;
150150
JAVA_BYTECODE_LANGUAGE_OPTIONS
151151
// clang-format on
152152

153-
class janalyzer_parse_optionst : public parse_options_baset, public messaget
153+
class janalyzer_parse_optionst : public parse_options_baset
154154
{
155155
public:
156156
virtual int doit() override;

0 commit comments

Comments
 (0)