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,18 @@ 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 use '--java-load-class somepackage.SomeClass'"
549
+ " or '--lazy-methods-extra-entry-point "
550
+ " somepackage.SomeClass.method' along with '--classpath'"
551
+ << messaget::eom;
551
552
return 6 ;
552
553
}
553
554
@@ -563,7 +564,7 @@ int jbmc_parse_optionst::doit()
563
564
if (cmdline.isset (" show-properties" ))
564
565
{
565
566
show_properties (
566
- goto_model, get_message_handler (), ui_message_handler.get_ui ());
567
+ goto_model, log . get_message_handler (), ui_message_handler.get_ui ());
567
568
return 0 ; // should contemplate EX_OK from sysexits.h
568
569
}
569
570
@@ -681,8 +682,8 @@ int jbmc_parse_optionst::doit()
681
682
else
682
683
{
683
684
// Use symex-driven lazy loading:
684
- lazy_goto_modelt lazy_goto_model= lazy_goto_modelt::from_handler_object (
685
- *this , options, get_message_handler () );
685
+ lazy_goto_modelt lazy_goto_model =
686
+ lazy_goto_modelt::from_handler_object ( *this , options, ui_message_handler );
686
687
lazy_goto_model.initialize (cmdline.args , options);
687
688
688
689
class_hierarchy =
@@ -693,7 +694,7 @@ int jbmc_parse_optionst::doit()
693
694
// trip an invariant when it tries to load it)
694
695
if (!lazy_goto_model.symbol_table .has_symbol (goto_functionst::entry_point ()))
695
696
{
696
- error () << " the program has no entry point" ;
697
+ log . error () << " the program has no entry point" ;
697
698
return 6 ;
698
699
}
699
700
@@ -738,8 +739,8 @@ int jbmc_parse_optionst::get_goto_program(
738
739
const optionst &options)
739
740
{
740
741
{
741
- lazy_goto_modelt lazy_goto_model= lazy_goto_modelt::from_handler_object (
742
- *this , options, get_message_handler () );
742
+ lazy_goto_modelt lazy_goto_model =
743
+ lazy_goto_modelt::from_handler_object ( *this , options, ui_message_handler );
743
744
lazy_goto_model.initialize (cmdline.args , options);
744
745
745
746
class_hierarchy =
@@ -756,7 +757,7 @@ int jbmc_parse_optionst::get_goto_program(
756
757
// particular function:
757
758
add_failed_symbols (lazy_goto_model.symbol_table );
758
759
759
- status () << " Generating GOTO Program" << messaget::eom;
760
+ log . status () << " Generating GOTO Program" << messaget::eom;
760
761
lazy_goto_model.load_all_functions ();
761
762
762
763
// Show the symbol table before process_goto_functions mangles return
@@ -798,13 +799,13 @@ int jbmc_parse_optionst::get_goto_program(
798
799
{
799
800
show_goto_functions (
800
801
*goto_model,
801
- get_message_handler (),
802
+ log . get_message_handler (),
802
803
ui_message_handler.get_ui (),
803
804
cmdline.isset (" list-goto-functions" ));
804
805
return 0 ;
805
806
}
806
807
807
- status () << config.object_bits_info () << eom;
808
+ log . status () << config.object_bits_info () << messaget:: eom;
808
809
}
809
810
810
811
return -1 ; // no error, continue
@@ -829,7 +830,7 @@ void jbmc_parse_optionst::process_goto_function(
829
830
goto_function,
830
831
symbol_table,
831
832
*class_hierarchy,
832
- get_message_handler ());
833
+ log . get_message_handler ());
833
834
// Java virtual functions -> explicit dispatch tables:
834
835
remove_virtual_functions (function);
835
836
@@ -844,10 +845,7 @@ void jbmc_parse_optionst::process_goto_function(
844
845
845
846
// Similar removal of java nondet statements:
846
847
convert_nondet (
847
- function,
848
- get_message_handler (),
849
- object_factory_params,
850
- ID_java);
848
+ function, ui_message_handler, object_factory_params, ID_java);
851
849
852
850
if (using_symex_driven_loading)
853
851
{
@@ -861,7 +859,7 @@ void jbmc_parse_optionst::process_goto_function(
861
859
goto_function.body ,
862
860
symbol_table,
863
861
*class_hierarchy.get (),
864
- get_message_handler () );
862
+ ui_message_handler );
865
863
}
866
864
867
865
// add generic checks
@@ -873,7 +871,7 @@ void jbmc_parse_optionst::process_goto_function(
873
871
function.get_function_id (),
874
872
goto_function,
875
873
symbol_table,
876
- get_message_handler () );
874
+ ui_message_handler );
877
875
878
876
// checks don't know about adjusted float expressions
879
877
adjust_float_expressions (goto_function, ns);
@@ -932,7 +930,7 @@ bool jbmc_parse_optionst::show_loaded_functions(
932
930
namespacet ns (goto_model.get_symbol_table ());
933
931
show_goto_functions (
934
932
ns,
935
- get_message_handler () ,
933
+ ui_message_handler ,
936
934
ui_message_handler.get_ui (),
937
935
goto_model.get_goto_functions (),
938
936
cmdline.isset (" list-goto-functions" ));
@@ -944,7 +942,7 @@ bool jbmc_parse_optionst::show_loaded_functions(
944
942
namespacet ns (goto_model.get_symbol_table ());
945
943
show_properties (
946
944
ns,
947
- get_message_handler (),
945
+ log . get_message_handler (),
948
946
ui_message_handler.get_ui (),
949
947
goto_model.get_goto_functions ());
950
948
return true ;
@@ -958,7 +956,8 @@ bool jbmc_parse_optionst::process_goto_functions(
958
956
const optionst &options)
959
957
{
960
958
{
961
- status () << " Running GOTO functions transformation passes" << eom;
959
+ log .status () << " Running GOTO functions transformation passes"
960
+ << messaget::eom;
962
961
963
962
bool using_symex_driven_loading =
964
963
options.get_bool_option (" symex-driven-lazy-loading" );
@@ -970,7 +969,7 @@ bool jbmc_parse_optionst::process_goto_functions(
970
969
971
970
// remove catch and throw
972
971
remove_exceptions (
973
- goto_model, *class_hierarchy.get (), get_message_handler ());
972
+ goto_model, *class_hierarchy.get (), log . get_message_handler ());
974
973
975
974
// instrument library preconditions
976
975
instrument_preconditions (goto_model);
@@ -979,8 +978,9 @@ bool jbmc_parse_optionst::process_goto_functions(
979
978
// of variables with static lifetime
980
979
if (cmdline.isset (" nondet-static" ))
981
980
{
982
- status () << " Adding nondeterministic initialization "
983
- " of static/global variables" << eom;
981
+ log .status () << " Adding nondeterministic initialization "
982
+ " of static/global variables"
983
+ << messaget::eom;
984
984
nondet_static (goto_model);
985
985
}
986
986
@@ -990,8 +990,8 @@ bool jbmc_parse_optionst::process_goto_functions(
990
990
if (cmdline.isset (" drop-unused-functions" ))
991
991
{
992
992
// 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 ());
993
+ log . status () << " Removing unused functions" << messaget:: eom;
994
+ remove_unused_functions (goto_model, log . get_message_handler ());
995
995
}
996
996
997
997
// remove skips such that trivial GOTOs are deleted
@@ -1009,12 +1009,13 @@ bool jbmc_parse_optionst::process_goto_functions(
1009
1009
{
1010
1010
if (cmdline.isset (" reachability-slice" ))
1011
1011
{
1012
- error () << " --reachability-slice and --reachability-slice-fb "
1013
- << " must not be given together" << eom;
1012
+ log . error () << " --reachability-slice and --reachability-slice-fb "
1013
+ << " must not be given together" << messaget:: eom;
1014
1014
return true ;
1015
1015
}
1016
1016
1017
- status () << " Performing a forwards-backwards reachability slice" << eom;
1017
+ log .status () << " Performing a forwards-backwards reachability slice"
1018
+ << messaget::eom;
1018
1019
if (cmdline.isset (" property" ))
1019
1020
reachability_slicer (goto_model, cmdline.get_values (" property" ), true );
1020
1021
else
@@ -1023,7 +1024,7 @@ bool jbmc_parse_optionst::process_goto_functions(
1023
1024
1024
1025
if (cmdline.isset (" reachability-slice" ))
1025
1026
{
1026
- status () << " Performing a reachability slice" << eom;
1027
+ log . status () << " Performing a reachability slice" << messaget:: eom;
1027
1028
if (cmdline.isset (" property" ))
1028
1029
reachability_slicer (goto_model, cmdline.get_values (" property" ));
1029
1030
else
@@ -1033,7 +1034,7 @@ bool jbmc_parse_optionst::process_goto_functions(
1033
1034
// full slice?
1034
1035
if (cmdline.isset (" full-slice" ))
1035
1036
{
1036
- status () << " Performing a full slice" << eom;
1037
+ log . status () << " Performing a full slice" << messaget:: eom;
1037
1038
if (cmdline.isset (" property" ))
1038
1039
property_slicer (goto_model, cmdline.get_values (" property" ));
1039
1040
else
@@ -1076,9 +1077,9 @@ bool jbmc_parse_optionst::generate_function_body(
1076
1077
symbol_table,
1077
1078
stub_objects_are_not_null,
1078
1079
object_factory_params,
1079
- get_message_handler () );
1080
+ ui_message_handler );
1080
1081
1081
- goto_convert_functionst converter (symbol_table, get_message_handler () );
1082
+ goto_convert_functionst converter (symbol_table, ui_message_handler );
1082
1083
converter.convert_function (function_name, function);
1083
1084
1084
1085
return true ;
0 commit comments