78
78
79
79
jbmc_parse_optionst::jbmc_parse_optionst (int argc, const char **argv)
80
80
: parse_options_baset(JBMC_OPTIONS, argc, argv, ui_message_handler),
81
- messaget(ui_message_handler),
82
81
ui_message_handler(cmdline, std::string(" JBMC " ) + CBMC_VERSION)
83
82
{
84
83
}
@@ -92,7 +91,6 @@ ::jbmc_parse_optionst::jbmc_parse_optionst(
92
91
argc,
93
92
argv,
94
93
ui_message_handler),
95
- messaget(ui_message_handler),
96
94
ui_message_handler(cmdline, std::string(" JBMC " ) + CBMC_VERSION)
97
95
{
98
96
}
@@ -134,11 +132,11 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
134
132
135
133
if (cmdline.isset (" show-symex-strategies" ))
136
134
{
137
- status () << show_path_strategies () << eom;
135
+ log . status () << show_path_strategies () << messaget:: eom;
138
136
exit (CPROVER_EXIT_SUCCESS);
139
137
}
140
138
141
- parse_path_strategy_options (cmdline, options, ui_message_handler );
139
+ parse_path_strategy_options (cmdline, options, log . get_message_handler () );
142
140
143
141
if (cmdline.isset (" program-only" ))
144
142
options.set_option (" program-only" , true );
@@ -217,8 +215,8 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
217
215
if (options.get_bool_option (" partial-loops" ) &&
218
216
options.get_bool_option (" unwinding-assertions" ))
219
217
{
220
- error () << " --partial-loops and --unwinding-assertions "
221
- << " must not be given together" << eom;
218
+ log . error () << " --partial-loops and --unwinding-assertions "
219
+ << " must not be given together" << messaget:: eom;
222
220
exit (1 ); // should contemplate EX_USAGE from sysexits.h
223
221
}
224
222
@@ -293,7 +291,7 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
293
291
294
292
if (cmdline.isset (" smt1" ))
295
293
{
296
- error () << " --smt1 is no longer supported" << eom;
294
+ log . error () << " --smt1 is no longer supported" << messaget:: eom;
297
295
exit (CPROVER_EXIT_USAGE_ERROR);
298
296
}
299
297
@@ -424,8 +422,10 @@ int jbmc_parse_optionst::doit()
424
422
return 0 ; // should contemplate EX_OK from sysexits.h
425
423
}
426
424
427
- eval_verbosity (
428
- cmdline.get_value (" verbosity" ), messaget::M_STATISTICS, ui_message_handler);
425
+ messaget::eval_verbosity (
426
+ cmdline.get_value (" verbosity" ),
427
+ messaget::M_STATISTICS,
428
+ log .get_message_handler ());
429
429
430
430
//
431
431
// command line options
@@ -437,28 +437,29 @@ int jbmc_parse_optionst::doit()
437
437
//
438
438
// Print a banner
439
439
//
440
- status () << " JBMC version " << CBMC_VERSION << " " << sizeof (void *) * 8
441
- << " -bit " << config.this_architecture () << " "
442
- << config.this_operating_system () << eom;
440
+ log . status () << " JBMC version " << CBMC_VERSION << " " << sizeof (void *) * 8
441
+ << " -bit " << config.this_architecture () << " "
442
+ << config.this_operating_system () << messaget:: eom;
443
443
444
444
// output the options
445
445
switch (ui_message_handler.get_ui ())
446
446
{
447
447
case ui_message_handlert::uit::PLAIN:
448
- conditional_output (debug (), [&options](messaget::mstreamt &debug_stream) {
449
- debug_stream << " \n Options: \n " ;
450
- options.output (debug_stream);
451
- debug_stream << messaget::eom;
452
- });
448
+ log .conditional_output (
449
+ log .debug (), [&options](messaget::mstreamt &debug_stream) {
450
+ debug_stream << " \n Options: \n " ;
451
+ options.output (debug_stream);
452
+ debug_stream << messaget::eom;
453
+ });
453
454
break ;
454
455
case ui_message_handlert::uit::JSON_UI:
455
456
{
456
457
json_objectt json_options{{" options" , options.to_json ()}};
457
- debug () << json_options;
458
+ log . debug () << json_options;
458
459
break ;
459
460
}
460
461
case ui_message_handlert::uit::XML_UI:
461
- debug () << options.to_xml ();
462
+ log . debug () << options.to_xml ();
462
463
break ;
463
464
}
464
465
@@ -469,7 +470,7 @@ int jbmc_parse_optionst::doit()
469
470
{
470
471
if (cmdline.args .size ()!=1 )
471
472
{
472
- error () << " Please give exactly one source file" << eom;
473
+ log . error () << " Please give exactly one source file" << messaget:: eom;
473
474
return 6 ;
474
475
}
475
476
@@ -483,8 +484,8 @@ int jbmc_parse_optionst::doit()
483
484
484
485
if (!infile)
485
486
{
486
- error () << " failed to open input file `"
487
- << filename << " ' " << eom;
487
+ log . error () << " failed to open input file `" << filename << " ' "
488
+ << messaget:: eom;
488
489
return 6 ;
489
490
}
490
491
@@ -493,19 +494,19 @@ int jbmc_parse_optionst::doit()
493
494
494
495
if (language==nullptr )
495
496
{
496
- error () << " failed to figure out type of file `"
497
- << filename << " ' " << eom;
497
+ log . error () << " failed to figure out type of file `" << filename << " ' "
498
+ << messaget:: eom;
498
499
return 6 ;
499
500
}
500
501
501
502
language->set_language_options (options);
502
- language->set_message_handler (get_message_handler ());
503
+ language->set_message_handler (log . get_message_handler ());
503
504
504
- status () << " Parsing " << filename << eom;
505
+ log . status () << " Parsing " << filename << messaget:: eom;
505
506
506
507
if (language->parse (infile, filename))
507
508
{
508
- error () << " PARSING ERROR" << eom;
509
+ log . error () << " PARSING ERROR" << messaget:: eom;
509
510
return 6 ;
510
511
}
511
512
@@ -536,18 +537,20 @@ int jbmc_parse_optionst::doit()
536
537
537
538
if (cmdline.args .empty ())
538
539
{
539
- error () << " Please provide a program to verify" << eom;
540
+ log . error () << " Please provide a program to verify" << messaget:: eom;
540
541
return 6 ;
541
542
}
542
543
543
544
if (cmdline.args .size () != 1 )
544
545
{
545
- error () << " Only one .class, .jar or .gbf file should be directly "
546
- " specified on the command-line. To force loading another another class "
547
- " use '--java-load-class somepackage.SomeClass' or "
548
- " '--lazy-methods-extra-entry-point somepackage.SomeClass.method' along "
549
- " with '--classpath'"
550
- << messaget::eom;
546
+ log .error () << " Only one .class, .jar or .gbf file should be directly "
547
+ " specified on the command-line. To force loading another "
548
+ " another class "
549
+ " use '--java-load-class somepackage.SomeClass' or "
550
+ " '--lazy-methods-extra-entry-point "
551
+ " somepackage.SomeClass.method' along "
552
+ " with '--classpath'"
553
+ << messaget::eom;
551
554
return 6 ;
552
555
}
553
556
@@ -563,7 +566,7 @@ int jbmc_parse_optionst::doit()
563
566
if (cmdline.isset (" show-properties" ))
564
567
{
565
568
show_properties (
566
- goto_model, get_message_handler (), ui_message_handler.get_ui ());
569
+ goto_model, log . get_message_handler (), ui_message_handler.get_ui ());
567
570
return 0 ; // should contemplate EX_OK from sysexits.h
568
571
}
569
572
@@ -681,8 +684,8 @@ int jbmc_parse_optionst::doit()
681
684
else
682
685
{
683
686
// Use symex-driven lazy loading:
684
- lazy_goto_modelt lazy_goto_model= lazy_goto_modelt::from_handler_object (
685
- *this , options, get_message_handler () );
687
+ lazy_goto_modelt lazy_goto_model =
688
+ lazy_goto_modelt::from_handler_object ( *this , options, ui_message_handler );
686
689
lazy_goto_model.initialize (cmdline.args , options);
687
690
688
691
class_hierarchy =
@@ -693,7 +696,7 @@ int jbmc_parse_optionst::doit()
693
696
// trip an invariant when it tries to load it)
694
697
if (!lazy_goto_model.symbol_table .has_symbol (goto_functionst::entry_point ()))
695
698
{
696
- error () << " the program has no entry point" ;
699
+ log . error () << " the program has no entry point" ;
697
700
return 6 ;
698
701
}
699
702
@@ -738,8 +741,8 @@ int jbmc_parse_optionst::get_goto_program(
738
741
const optionst &options)
739
742
{
740
743
{
741
- lazy_goto_modelt lazy_goto_model= lazy_goto_modelt::from_handler_object (
742
- *this , options, get_message_handler () );
744
+ lazy_goto_modelt lazy_goto_model =
745
+ lazy_goto_modelt::from_handler_object ( *this , options, ui_message_handler );
743
746
lazy_goto_model.initialize (cmdline.args , options);
744
747
745
748
class_hierarchy =
@@ -756,7 +759,7 @@ int jbmc_parse_optionst::get_goto_program(
756
759
// particular function:
757
760
add_failed_symbols (lazy_goto_model.symbol_table );
758
761
759
- status () << " Generating GOTO Program" << messaget::eom;
762
+ log . status () << " Generating GOTO Program" << messaget::eom;
760
763
lazy_goto_model.load_all_functions ();
761
764
762
765
// Show the symbol table before process_goto_functions mangles return
@@ -798,13 +801,13 @@ int jbmc_parse_optionst::get_goto_program(
798
801
{
799
802
show_goto_functions (
800
803
*goto_model,
801
- get_message_handler (),
804
+ log . get_message_handler (),
802
805
ui_message_handler.get_ui (),
803
806
cmdline.isset (" list-goto-functions" ));
804
807
return 0 ;
805
808
}
806
809
807
- status () << config.object_bits_info () << eom;
810
+ log . status () << config.object_bits_info () << messaget:: eom;
808
811
}
809
812
810
813
return -1 ; // no error, continue
@@ -829,7 +832,7 @@ void jbmc_parse_optionst::process_goto_function(
829
832
goto_function,
830
833
symbol_table,
831
834
*class_hierarchy,
832
- get_message_handler ());
835
+ log . get_message_handler ());
833
836
// Java virtual functions -> explicit dispatch tables:
834
837
remove_virtual_functions (function);
835
838
@@ -844,10 +847,7 @@ void jbmc_parse_optionst::process_goto_function(
844
847
845
848
// Similar removal of java nondet statements:
846
849
convert_nondet (
847
- function,
848
- get_message_handler (),
849
- object_factory_params,
850
- ID_java);
850
+ function, ui_message_handler, object_factory_params, ID_java);
851
851
852
852
if (using_symex_driven_loading)
853
853
{
@@ -861,7 +861,7 @@ void jbmc_parse_optionst::process_goto_function(
861
861
goto_function.body ,
862
862
symbol_table,
863
863
*class_hierarchy.get (),
864
- get_message_handler () );
864
+ ui_message_handler );
865
865
}
866
866
867
867
// add generic checks
@@ -873,7 +873,7 @@ void jbmc_parse_optionst::process_goto_function(
873
873
function.get_function_id (),
874
874
goto_function,
875
875
symbol_table,
876
- get_message_handler () );
876
+ ui_message_handler );
877
877
878
878
// checks don't know about adjusted float expressions
879
879
adjust_float_expressions (goto_function, ns);
@@ -932,7 +932,7 @@ bool jbmc_parse_optionst::show_loaded_functions(
932
932
namespacet ns (goto_model.get_symbol_table ());
933
933
show_goto_functions (
934
934
ns,
935
- get_message_handler () ,
935
+ ui_message_handler ,
936
936
ui_message_handler.get_ui (),
937
937
goto_model.get_goto_functions (),
938
938
cmdline.isset (" list-goto-functions" ));
@@ -944,7 +944,7 @@ bool jbmc_parse_optionst::show_loaded_functions(
944
944
namespacet ns (goto_model.get_symbol_table ());
945
945
show_properties (
946
946
ns,
947
- get_message_handler (),
947
+ log . get_message_handler (),
948
948
ui_message_handler.get_ui (),
949
949
goto_model.get_goto_functions ());
950
950
return true ;
@@ -958,7 +958,8 @@ bool jbmc_parse_optionst::process_goto_functions(
958
958
const optionst &options)
959
959
{
960
960
{
961
- status () << " Running GOTO functions transformation passes" << eom;
961
+ log .status () << " Running GOTO functions transformation passes"
962
+ << messaget::eom;
962
963
963
964
bool using_symex_driven_loading =
964
965
options.get_bool_option (" symex-driven-lazy-loading" );
@@ -970,7 +971,7 @@ bool jbmc_parse_optionst::process_goto_functions(
970
971
971
972
// remove catch and throw
972
973
remove_exceptions (
973
- goto_model, *class_hierarchy.get (), get_message_handler ());
974
+ goto_model, *class_hierarchy.get (), log . get_message_handler ());
974
975
975
976
// instrument library preconditions
976
977
instrument_preconditions (goto_model);
@@ -979,8 +980,9 @@ bool jbmc_parse_optionst::process_goto_functions(
979
980
// of variables with static lifetime
980
981
if (cmdline.isset (" nondet-static" ))
981
982
{
982
- status () << " Adding nondeterministic initialization "
983
- " of static/global variables" << eom;
983
+ log .status () << " Adding nondeterministic initialization "
984
+ " of static/global variables"
985
+ << messaget::eom;
984
986
nondet_static (goto_model);
985
987
}
986
988
@@ -990,8 +992,8 @@ bool jbmc_parse_optionst::process_goto_functions(
990
992
if (cmdline.isset (" drop-unused-functions" ))
991
993
{
992
994
// Entry point will have been set before and function pointers removed
993
- status () << " Removing unused functions" << eom;
994
- remove_unused_functions (goto_model, get_message_handler ());
995
+ log . status () << " Removing unused functions" << messaget:: eom;
996
+ remove_unused_functions (goto_model, log . get_message_handler ());
995
997
}
996
998
997
999
// remove skips such that trivial GOTOs are deleted
@@ -1009,12 +1011,13 @@ bool jbmc_parse_optionst::process_goto_functions(
1009
1011
{
1010
1012
if (cmdline.isset (" reachability-slice" ))
1011
1013
{
1012
- error () << " --reachability-slice and --reachability-slice-fb "
1013
- << " must not be given together" << eom;
1014
+ log . error () << " --reachability-slice and --reachability-slice-fb "
1015
+ << " must not be given together" << messaget:: eom;
1014
1016
return true ;
1015
1017
}
1016
1018
1017
- status () << " Performing a forwards-backwards reachability slice" << eom;
1019
+ log .status () << " Performing a forwards-backwards reachability slice"
1020
+ << messaget::eom;
1018
1021
if (cmdline.isset (" property" ))
1019
1022
reachability_slicer (goto_model, cmdline.get_values (" property" ), true );
1020
1023
else
@@ -1023,7 +1026,7 @@ bool jbmc_parse_optionst::process_goto_functions(
1023
1026
1024
1027
if (cmdline.isset (" reachability-slice" ))
1025
1028
{
1026
- status () << " Performing a reachability slice" << eom;
1029
+ log . status () << " Performing a reachability slice" << messaget:: eom;
1027
1030
if (cmdline.isset (" property" ))
1028
1031
reachability_slicer (goto_model, cmdline.get_values (" property" ));
1029
1032
else
@@ -1033,7 +1036,7 @@ bool jbmc_parse_optionst::process_goto_functions(
1033
1036
// full slice?
1034
1037
if (cmdline.isset (" full-slice" ))
1035
1038
{
1036
- status () << " Performing a full slice" << eom;
1039
+ log . status () << " Performing a full slice" << messaget:: eom;
1037
1040
if (cmdline.isset (" property" ))
1038
1041
property_slicer (goto_model, cmdline.get_values (" property" ));
1039
1042
else
@@ -1076,9 +1079,9 @@ bool jbmc_parse_optionst::generate_function_body(
1076
1079
symbol_table,
1077
1080
stub_objects_are_not_null,
1078
1081
object_factory_params,
1079
- get_message_handler () );
1082
+ ui_message_handler );
1080
1083
1081
- goto_convert_functionst converter (symbol_table, get_message_handler () );
1084
+ goto_convert_functionst converter (symbol_table, ui_message_handler );
1082
1085
converter.convert_function (function_name, function);
1083
1086
1084
1087
return true ;
0 commit comments