59
59
60
60
janalyzer_parse_optionst::janalyzer_parse_optionst (int argc, const char **argv)
61
61
: parse_options_baset(JANALYZER_OPTIONS, argc, argv, ui_message_handler),
62
- messaget(ui_message_handler),
63
62
ui_message_handler(cmdline, std::string(" JANALYZER " ) + CBMC_VERSION)
64
63
{
65
64
}
@@ -260,7 +259,7 @@ void janalyzer_parse_optionst::get_command_line_options(optionst &options)
260
259
if (!options.get_bool_option (" domain set" ))
261
260
{
262
261
// 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;
264
263
options.set_option (" constants" , true );
265
264
}
266
265
}
@@ -343,21 +342,21 @@ int janalyzer_parse_optionst::doit()
343
342
344
343
optionst options;
345
344
get_command_line_options (options);
346
- eval_verbosity (
345
+ messaget:: eval_verbosity (
347
346
cmdline.get_value (" verbosity" ), messaget::M_STATISTICS, ui_message_handler);
348
347
349
348
//
350
349
// Print a banner
351
350
//
352
- status () << " JANALYZER version " << CBMC_VERSION << " " << sizeof (void *) * 8
351
+ log. status () << " JANALYZER version " << CBMC_VERSION << " " << sizeof (void *) * 8
353
352
<< " -bit " << config.this_architecture () << " "
354
- << config.this_operating_system () << eom;
353
+ << config.this_operating_system () << messaget:: eom;
355
354
356
355
register_languages ();
357
356
358
357
if (cmdline.args .size () > 1 )
359
358
{
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 "
361
360
" specified on the command-line. To force loading another another class "
362
361
" use '--java-load-class somepackage.SomeClass' or "
363
362
" '--lazy-methods-extra-entry-point somepackage.SomeClass.method' along "
@@ -367,7 +366,7 @@ int janalyzer_parse_optionst::doit()
367
366
}
368
367
369
368
goto_model =
370
- initialize_goto_model (cmdline.args , get_message_handler (), options);
369
+ initialize_goto_model (cmdline.args , log. get_message_handler (), options);
371
370
372
371
if (process_goto_program (options))
373
372
return CPROVER_EXIT_INTERNAL_ERROR;
@@ -386,7 +385,7 @@ int janalyzer_parse_optionst::doit()
386
385
{
387
386
show_goto_functions (
388
387
goto_model,
389
- get_message_handler (),
388
+ log. get_message_handler (),
390
389
get_ui (),
391
390
cmdline.isset (" list-goto-functions" ));
392
391
return CPROVER_EXIT_SUCCESS;
@@ -404,14 +403,14 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
404
403
405
404
if (cmdline.isset (" show-taint" ))
406
405
{
407
- taint_analysis (goto_model, taint_file, get_message_handler (), true , " " );
406
+ taint_analysis (goto_model, taint_file, log. get_message_handler (), true , " " );
408
407
return CPROVER_EXIT_SUCCESS;
409
408
}
410
409
else
411
410
{
412
411
std::string json_file = cmdline.get_value (" json" );
413
412
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);
415
414
return result ? CPROVER_EXIT_VERIFICATION_UNSAFE : CPROVER_EXIT_SUCCESS;
416
415
}
417
416
}
@@ -432,7 +431,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
432
431
std::ofstream ofs (json_file);
433
432
if (!ofs)
434
433
{
435
- error () << " Failed to open json output `" << json_file << " '" << eom;
434
+ log. error () << " Failed to open json output `" << json_file << " '" << messaget:: eom;
436
435
return CPROVER_EXIT_INTERNAL_ERROR;
437
436
}
438
437
@@ -457,7 +456,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
457
456
std::ofstream ofs (json_file);
458
457
if (!ofs)
459
458
{
460
- error () << " Failed to open json output `" << json_file << " '" << eom;
459
+ log. error () << " Failed to open json output `" << json_file << " '" << messaget:: eom;
461
460
return CPROVER_EXIT_INTERNAL_ERROR;
462
461
}
463
462
@@ -482,7 +481,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
482
481
std::ofstream ofs (json_file);
483
482
if (!ofs)
484
483
{
485
- error () << " Failed to open json output `" << json_file << " '" << eom;
484
+ log. error () << " Failed to open json output `" << json_file << " '" << messaget:: eom;
486
485
return CPROVER_EXIT_INTERNAL_ERROR;
487
486
}
488
487
@@ -513,7 +512,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
513
512
514
513
if (cmdline.isset (" show-properties" ))
515
514
{
516
- show_properties (goto_model, get_message_handler (), get_ui ());
515
+ show_properties (goto_model, log. get_message_handler (), get_ui ());
517
516
return CPROVER_EXIT_SUCCESS;
518
517
}
519
518
@@ -532,28 +531,28 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
532
531
533
532
if (!out)
534
533
{
535
- error () << " Failed to open output file `" << outfile << " '" << eom;
534
+ log. error () << " Failed to open output file `" << outfile << " '" << messaget:: eom;
536
535
return CPROVER_EXIT_INTERNAL_ERROR;
537
536
}
538
537
539
538
// Build analyzer
540
- status () << " Selecting abstract domain" << eom;
539
+ log. status () << " Selecting abstract domain" << messaget:: eom;
541
540
namespacet ns (goto_model.symbol_table ); // Must live as long as the domain.
542
541
std::unique_ptr<ai_baset> analyzer (build_analyzer (options, ns));
543
542
544
543
if (analyzer == nullptr )
545
544
{
546
- status () << " Task / Interpreter / Domain combination not supported"
545
+ log. status () << " Task / Interpreter / Domain combination not supported"
547
546
<< messaget::eom;
548
547
return CPROVER_EXIT_INTERNAL_ERROR;
549
548
}
550
549
551
550
// Run
552
- status () << " Computing abstract states" << eom;
551
+ log. status () << " Computing abstract states" << messaget:: eom;
553
552
(*analyzer)(goto_model);
554
553
555
554
// Perform the task
556
- status () << " Performing task" << eom;
555
+ log. status () << " Performing task" << messaget:: eom;
557
556
bool result = true ;
558
557
if (options.get_bool_option (" show" ))
559
558
{
@@ -563,12 +562,12 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
563
562
else if (options.get_bool_option (" verify" ))
564
563
{
565
564
result = static_verifier (
566
- goto_model, *analyzer, options, get_message_handler (), out);
565
+ goto_model, *analyzer, options, log. get_message_handler (), out);
567
566
}
568
567
else if (options.get_bool_option (" simplify" ))
569
568
{
570
569
result = static_simplifier (
571
- goto_model, *analyzer, options, get_message_handler (), out);
570
+ goto_model, *analyzer, options, log. get_message_handler (), out);
572
571
}
573
572
else if (options.get_bool_option (" unreachable-instructions" ))
574
573
{
@@ -587,7 +586,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
587
586
}
588
587
else
589
588
{
590
- error () << " Unhandled task" << eom;
589
+ log. error () << " Unhandled task" << messaget:: eom;
591
590
return CPROVER_EXIT_INTERNAL_ERROR;
592
591
}
593
592
@@ -596,7 +595,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
596
595
}
597
596
598
597
// 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;
600
599
return CPROVER_EXIT_USAGE_ERROR;
601
600
}
602
601
@@ -605,23 +604,23 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
605
604
try
606
605
{
607
606
// remove function pointers
608
- status () << " Removing function pointers and virtual functions" << eom;
607
+ log. status () << " Removing function pointers and virtual functions" << messaget:: eom;
609
608
remove_function_pointers (
610
- get_message_handler (), goto_model, cmdline.isset (" pointer-check" ));
609
+ log. get_message_handler (), goto_model, cmdline.isset (" pointer-check" ));
611
610
612
611
// Java virtual functions -> explicit dispatch tables:
613
612
remove_virtual_functions (goto_model);
614
613
615
614
// remove Java throw and catch
616
615
// 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 ());
618
617
619
618
// Java instanceof -> clsid comparison:
620
619
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 ());
622
621
623
622
// do partial inlining
624
- status () << " Partial Inlining" << eom;
623
+ log. status () << " Partial Inlining" << messaget:: eom;
625
624
goto_partial_inline (goto_model, ui_message_handler);
626
625
627
626
// remove returns, gcc vectors, complex
@@ -630,7 +629,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
630
629
remove_complex (goto_model);
631
630
632
631
// add generic checks
633
- status () << " Generic Property Instrumentation" << eom;
632
+ log. status () << " Generic Property Instrumentation" << messaget:: eom;
634
633
goto_check (options, goto_model);
635
634
636
635
// recalculate numbers, etc.
@@ -642,13 +641,13 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
642
641
643
642
catch (const char *e)
644
643
{
645
- error () << e << eom;
644
+ log. error () << e << messaget:: eom;
646
645
return true ;
647
646
}
648
647
649
648
catch (const std::string &e)
650
649
{
651
- error () << e << eom;
650
+ log. error () << e << messaget:: eom;
652
651
return true ;
653
652
}
654
653
@@ -659,7 +658,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
659
658
660
659
catch (const std::bad_alloc &)
661
660
{
662
- error () << " Out of memory" << eom;
661
+ log. error () << " Out of memory" << messaget:: eom;
663
662
return true ;
664
663
}
665
664
0 commit comments