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,8 @@ 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"
263
+ << messaget::eom;
264
264
options.set_option (" constants" , true );
265
265
}
266
266
}
@@ -343,31 +343,33 @@ int janalyzer_parse_optionst::doit()
343
343
344
344
optionst options;
345
345
get_command_line_options (options);
346
- eval_verbosity (
346
+ messaget:: eval_verbosity (
347
347
cmdline.get_value (" verbosity" ), messaget::M_STATISTICS, ui_message_handler);
348
348
349
349
//
350
350
// Print a banner
351
351
//
352
- status () << " JANALYZER version " << CBMC_VERSION << " " << sizeof ( void *) * 8
353
- << " -bit " << config.this_architecture () << " "
354
- << config.this_operating_system () << eom;
352
+ log . status () << " JANALYZER version " << CBMC_VERSION << " "
353
+ << sizeof ( void *) * 8 << " -bit " << config.this_architecture ()
354
+ << " " << config.this_operating_system () << messaget:: eom;
355
355
356
356
register_languages ();
357
357
358
358
if (cmdline.args .size () > 1 )
359
359
{
360
- error () << " Only one .class, .jar or .gbf file should be directly "
361
- " specified on the command-line. To force loading another another class "
362
- " use '--java-load-class somepackage.SomeClass' or "
363
- " '--lazy-methods-extra-entry-point somepackage.SomeClass.method' along "
364
- " with '--classpath'"
365
- << messaget::eom;
360
+ log .error () << " Only one .class, .jar or .gbf file should be directly "
361
+ " specified on the command-line. To force loading another "
362
+ " another class "
363
+ " use '--java-load-class somepackage.SomeClass' or "
364
+ " '--lazy-methods-extra-entry-point "
365
+ " somepackage.SomeClass.method' along "
366
+ " with '--classpath'"
367
+ << messaget::eom;
366
368
return CPROVER_EXIT_USAGE_ERROR;
367
369
}
368
370
369
371
goto_model =
370
- initialize_goto_model (cmdline.args , get_message_handler (), options);
372
+ initialize_goto_model (cmdline.args , log . get_message_handler (), options);
371
373
372
374
if (process_goto_program (options))
373
375
return CPROVER_EXIT_INTERNAL_ERROR;
@@ -386,7 +388,7 @@ int janalyzer_parse_optionst::doit()
386
388
{
387
389
show_goto_functions (
388
390
goto_model,
389
- get_message_handler (),
391
+ log . get_message_handler (),
390
392
get_ui (),
391
393
cmdline.isset (" list-goto-functions" ));
392
394
return CPROVER_EXIT_SUCCESS;
@@ -404,14 +406,15 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
404
406
405
407
if (cmdline.isset (" show-taint" ))
406
408
{
407
- taint_analysis (goto_model, taint_file, get_message_handler (), true , " " );
409
+ taint_analysis (
410
+ goto_model, taint_file, log .get_message_handler (), true , " " );
408
411
return CPROVER_EXIT_SUCCESS;
409
412
}
410
413
else
411
414
{
412
415
std::string json_file = cmdline.get_value (" json" );
413
416
bool result = taint_analysis (
414
- goto_model, taint_file, get_message_handler (), false , json_file);
417
+ goto_model, taint_file, log . get_message_handler (), false , json_file);
415
418
return result ? CPROVER_EXIT_VERIFICATION_UNSAFE : CPROVER_EXIT_SUCCESS;
416
419
}
417
420
}
@@ -432,7 +435,8 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
432
435
std::ofstream ofs (json_file);
433
436
if (!ofs)
434
437
{
435
- error () << " Failed to open json output `" << json_file << " '" << eom;
438
+ log .error () << " Failed to open json output `" << json_file << " '"
439
+ << messaget::eom;
436
440
return CPROVER_EXIT_INTERNAL_ERROR;
437
441
}
438
442
@@ -457,7 +461,8 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
457
461
std::ofstream ofs (json_file);
458
462
if (!ofs)
459
463
{
460
- error () << " Failed to open json output `" << json_file << " '" << eom;
464
+ log .error () << " Failed to open json output `" << json_file << " '"
465
+ << messaget::eom;
461
466
return CPROVER_EXIT_INTERNAL_ERROR;
462
467
}
463
468
@@ -482,7 +487,8 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
482
487
std::ofstream ofs (json_file);
483
488
if (!ofs)
484
489
{
485
- error () << " Failed to open json output `" << json_file << " '" << eom;
490
+ log .error () << " Failed to open json output `" << json_file << " '"
491
+ << messaget::eom;
486
492
return CPROVER_EXIT_INTERNAL_ERROR;
487
493
}
488
494
@@ -513,7 +519,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
513
519
514
520
if (cmdline.isset (" show-properties" ))
515
521
{
516
- show_properties (goto_model, get_message_handler (), get_ui ());
522
+ show_properties (goto_model, log . get_message_handler (), get_ui ());
517
523
return CPROVER_EXIT_SUCCESS;
518
524
}
519
525
@@ -532,28 +538,29 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
532
538
533
539
if (!out)
534
540
{
535
- error () << " Failed to open output file `" << outfile << " '" << eom;
541
+ log .error () << " Failed to open output file `" << outfile << " '"
542
+ << messaget::eom;
536
543
return CPROVER_EXIT_INTERNAL_ERROR;
537
544
}
538
545
539
546
// Build analyzer
540
- status () << " Selecting abstract domain" << eom;
547
+ log . status () << " Selecting abstract domain" << messaget:: eom;
541
548
namespacet ns (goto_model.symbol_table ); // Must live as long as the domain.
542
549
std::unique_ptr<ai_baset> analyzer (build_analyzer (options, ns));
543
550
544
551
if (analyzer == nullptr )
545
552
{
546
- status () << " Task / Interpreter / Domain combination not supported"
547
- << messaget::eom;
553
+ log . status () << " Task / Interpreter / Domain combination not supported"
554
+ << messaget::eom;
548
555
return CPROVER_EXIT_INTERNAL_ERROR;
549
556
}
550
557
551
558
// Run
552
- status () << " Computing abstract states" << eom;
559
+ log . status () << " Computing abstract states" << messaget:: eom;
553
560
(*analyzer)(goto_model);
554
561
555
562
// Perform the task
556
- status () << " Performing task" << eom;
563
+ log . status () << " Performing task" << messaget:: eom;
557
564
bool result = true ;
558
565
if (options.get_bool_option (" show" ))
559
566
{
@@ -563,12 +570,12 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
563
570
else if (options.get_bool_option (" verify" ))
564
571
{
565
572
result = static_verifier (
566
- goto_model, *analyzer, options, get_message_handler (), out);
573
+ goto_model, *analyzer, options, log . get_message_handler (), out);
567
574
}
568
575
else if (options.get_bool_option (" simplify" ))
569
576
{
570
577
result = static_simplifier (
571
- goto_model, *analyzer, options, get_message_handler (), out);
578
+ goto_model, *analyzer, options, log . get_message_handler (), out);
572
579
}
573
580
else if (options.get_bool_option (" unreachable-instructions" ))
574
581
{
@@ -587,7 +594,7 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
587
594
}
588
595
else
589
596
{
590
- error () << " Unhandled task" << eom;
597
+ log . error () << " Unhandled task" << messaget:: eom;
591
598
return CPROVER_EXIT_INTERNAL_ERROR;
592
599
}
593
600
@@ -596,7 +603,8 @@ int janalyzer_parse_optionst::perform_analysis(const optionst &options)
596
603
}
597
604
598
605
// Final defensive error case
599
- error () << " no analysis option given -- consider reading --help" << eom;
606
+ log .error () << " no analysis option given -- consider reading --help"
607
+ << messaget::eom;
600
608
return CPROVER_EXIT_USAGE_ERROR;
601
609
}
602
610
@@ -605,23 +613,24 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
605
613
try
606
614
{
607
615
// remove function pointers
608
- status () << " Removing function pointers and virtual functions" << eom;
616
+ log .status () << " Removing function pointers and virtual functions"
617
+ << messaget::eom;
609
618
remove_function_pointers (
610
- get_message_handler (), goto_model, cmdline.isset (" pointer-check" ));
619
+ log . get_message_handler (), goto_model, cmdline.isset (" pointer-check" ));
611
620
612
621
// Java virtual functions -> explicit dispatch tables:
613
622
remove_virtual_functions (goto_model);
614
623
615
624
// remove Java throw and catch
616
625
// This introduces instanceof, so order is important:
617
- remove_exceptions_using_instanceof (goto_model, get_message_handler ());
626
+ remove_exceptions_using_instanceof (goto_model, log . get_message_handler ());
618
627
619
628
// Java instanceof -> clsid comparison:
620
629
class_hierarchyt class_hierarchy (goto_model.symbol_table );
621
- remove_instanceof (goto_model, class_hierarchy, get_message_handler ());
630
+ remove_instanceof (goto_model, class_hierarchy, log . get_message_handler ());
622
631
623
632
// do partial inlining
624
- status () << " Partial Inlining" << eom;
633
+ log . status () << " Partial Inlining" << messaget:: eom;
625
634
goto_partial_inline (goto_model, ui_message_handler);
626
635
627
636
// remove returns, gcc vectors, complex
@@ -630,7 +639,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
630
639
remove_complex (goto_model);
631
640
632
641
// add generic checks
633
- status () << " Generic Property Instrumentation" << eom;
642
+ log . status () << " Generic Property Instrumentation" << messaget:: eom;
634
643
goto_check (options, goto_model);
635
644
636
645
// recalculate numbers, etc.
@@ -642,13 +651,13 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
642
651
643
652
catch (const char *e)
644
653
{
645
- error () << e << eom;
654
+ log . error () << e << messaget:: eom;
646
655
return true ;
647
656
}
648
657
649
658
catch (const std::string &e)
650
659
{
651
- error () << e << eom;
660
+ log . error () << e << messaget:: eom;
652
661
return true ;
653
662
}
654
663
@@ -659,7 +668,7 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
659
668
660
669
catch (const std::bad_alloc &)
661
670
{
662
- error () << " Out of memory" << eom;
671
+ log . error () << " Out of memory" << messaget:: eom;
663
672
return true ;
664
673
}
665
674
0 commit comments