@@ -733,46 +733,45 @@ int jbmc_parse_optionst::get_goto_program(
733
733
std::unique_ptr<goto_modelt> &goto_model,
734
734
const optionst &options)
735
735
{
736
- {
737
- lazy_goto_modelt lazy_goto_model =
738
- lazy_goto_modelt::from_handler_object (*this , options, ui_message_handler);
739
- lazy_goto_model.initialize (cmdline.args , options);
736
+ lazy_goto_modelt lazy_goto_model = lazy_goto_modelt::from_handler_object (
737
+ *this , options, ui_message_handler);
738
+ lazy_goto_model.initialize (cmdline.args , options);
740
739
741
- class_hierarchy =
742
- util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table );
740
+ class_hierarchy =
741
+ util_make_unique<class_hierarchyt>(lazy_goto_model.symbol_table );
743
742
744
- // Show the class hierarchy
745
- if (cmdline.isset (" show-class-hierarchy" ))
746
- {
747
- show_class_hierarchy (*class_hierarchy, ui_message_handler);
748
- return CPROVER_EXIT_SUCCESS;
749
- }
743
+ // Show the class hierarchy
744
+ if (cmdline.isset (" show-class-hierarchy" ))
745
+ {
746
+ show_class_hierarchy (*class_hierarchy, ui_message_handler);
747
+ return CPROVER_EXIT_SUCCESS;
748
+ }
750
749
751
- // Add failed symbols for any symbol created prior to loading any
752
- // particular function:
753
- add_failed_symbols (lazy_goto_model.symbol_table );
750
+ // Add failed symbols for any symbol created prior to loading any
751
+ // particular function:
752
+ add_failed_symbols (lazy_goto_model.symbol_table );
754
753
755
754
log.status () << " Generating GOTO Program" << messaget::eom;
756
755
lazy_goto_model.load_all_functions ();
757
756
758
- // show symbol table or list symbols
759
- if (show_loaded_symbols (lazy_goto_model))
760
- return CPROVER_EXIT_SUCCESS;
757
+ // show symbol table or list symbols
758
+ if (show_loaded_symbols (lazy_goto_model))
759
+ return CPROVER_EXIT_SUCCESS;
761
760
762
- // Move the model out of the local lazy_goto_model
763
- // and into the caller's goto_model
764
- goto_model= lazy_goto_modelt::process_whole_model_and_freeze (
765
- std::move (lazy_goto_model));
766
- if (goto_model == nullptr )
767
- return 6 ;
761
+ // Move the model out of the local lazy_goto_model
762
+ // and into the caller's goto_model
763
+ goto_model = lazy_goto_modelt::process_whole_model_and_freeze (
764
+ std::move (lazy_goto_model));
765
+ if (goto_model == nullptr )
766
+ return 6 ;
768
767
769
- if (cmdline.isset (" validate-goto-model" ))
770
- {
771
- goto_model->validate ();
772
- }
768
+ if (cmdline.isset (" validate-goto-model" ))
769
+ {
770
+ goto_model->validate ();
771
+ }
773
772
774
- if (show_loaded_functions (*goto_model))
775
- return CPROVER_EXIT_SUCCESS;
773
+ if (show_loaded_functions (*goto_model))
774
+ return CPROVER_EXIT_SUCCESS;
776
775
777
776
log.status () << config.object_bits_info () << messaget::eom;
778
777
}
@@ -792,83 +791,80 @@ void jbmc_parse_optionst::process_goto_function(
792
791
bool using_symex_driven_loading =
793
792
options.get_bool_option (" symex-driven-lazy-loading" );
794
793
795
- {
796
- // Removal of RTTI inspection:
797
- remove_instanceof (
798
- function.get_function_id (),
799
- goto_function,
800
- symbol_table,
801
- *class_hierarchy,
802
- log.get_message_handler ());
803
- // Java virtual functions -> explicit dispatch tables:
804
- remove_virtual_functions (function);
805
-
806
- auto function_is_stub = [&symbol_table, &model](const irep_idt &id) {
807
- return symbol_table.lookup_ref (id).value .is_nil () &&
808
- !model.can_produce_function (id);
809
- };
810
-
811
- remove_returns (function, function_is_stub);
794
+ // Removal of RTTI inspection:
795
+ remove_instanceof (
796
+ function.get_function_id (),
797
+ goto_function,
798
+ symbol_table,
799
+ *class_hierarchy,
800
+ log.get_message_handler ());
801
+ // Java virtual functions -> explicit dispatch tables:
802
+ remove_virtual_functions (function);
812
803
813
- replace_java_nondet (function);
804
+ auto function_is_stub = [&symbol_table, &model](const irep_idt &id) {
805
+ return symbol_table.lookup_ref (id).value .is_nil () &&
806
+ !model.can_produce_function (id);
807
+ };
814
808
815
- // Similar removal of java nondet statements:
816
- convert_nondet (
817
- function, ui_message_handler, object_factory_params, ID_java);
809
+ remove_returns (function, function_is_stub);
818
810
819
- if (using_symex_driven_loading)
820
- {
821
- // remove exceptions
822
- // If using symex-driven function loading we need to do this now so that
823
- // symex doesn't have to cope with exception-handling constructs; however
824
- // the results are slightly worse than running it in whole-program mode
825
- // (e.g. dead catch sites will be retained)
826
- remove_exceptions (
827
- function.get_function_id (),
828
- goto_function.body ,
829
- symbol_table,
830
- *class_hierarchy.get (),
831
- ui_message_handler);
832
- }
811
+ replace_java_nondet (function);
833
812
834
- // add generic checks
835
- goto_check (
836
- function. get_function_id (), function. get_goto_function (), ns, options );
813
+ // Similar removal of java nondet statements:
814
+ convert_nondet (
815
+ function, ui_message_handler, object_factory_params, ID_java );
837
816
838
- // Replace Java new side effects
839
- remove_java_new (
817
+ if (using_symex_driven_loading)
818
+ {
819
+ // remove exceptions
820
+ // If using symex-driven function loading we need to do this now so that
821
+ // symex doesn't have to cope with exception-handling constructs; however
822
+ // the results are slightly worse than running it in whole-program mode
823
+ // (e.g. dead catch sites will be retained)
824
+ remove_exceptions (
840
825
function.get_function_id (),
841
- goto_function,
826
+ goto_function. body ,
842
827
symbol_table,
828
+ *class_hierarchy.get (),
843
829
ui_message_handler);
830
+ }
844
831
845
- // checks don't know about adjusted float expressions
846
- adjust_float_expressions (goto_function, ns);
847
-
848
- // add failed symbols for anything created relating to this particular
849
- // function (note this means subseqent passes mustn't create more!):
850
- journalling_symbol_tablet::changesett new_symbols =
851
- symbol_table.get_inserted ();
852
- for (const irep_idt &new_symbol_name : new_symbols)
853
- {
854
- add_failed_symbol_if_needed (
855
- symbol_table.lookup_ref (new_symbol_name),
856
- symbol_table);
857
- }
832
+ // add generic checks
833
+ goto_check (
834
+ function.get_function_id (), function.get_goto_function (), ns, options);
835
+
836
+ // Replace Java new side effects
837
+ remove_java_new (
838
+ function.get_function_id (),
839
+ goto_function,
840
+ symbol_table,
841
+ get_message_handler ());
842
+
843
+ // checks don't know about adjusted float expressions
844
+ adjust_float_expressions (goto_function, ns);
845
+
846
+ // add failed symbols for anything created relating to this particular
847
+ // function (note this means subseqent passes mustn't create more!):
848
+ journalling_symbol_tablet::changesett new_symbols =
849
+ symbol_table.get_inserted ();
850
+ for (const irep_idt &new_symbol_name : new_symbols)
851
+ {
852
+ add_failed_symbol_if_needed (
853
+ symbol_table.lookup_ref (new_symbol_name), symbol_table);
854
+ }
858
855
859
- // If using symex-driven function loading we must label the assertions
860
- // now so symex sees its targets; otherwise we leave this until
861
- // process_goto_functions, as we haven't run remove_exceptions yet, and that
862
- // pass alters the CFG.
863
- if (using_symex_driven_loading)
864
- {
865
- // label the assertions
866
- label_properties (goto_function.body );
856
+ // If using symex-driven function loading we must label the assertions
857
+ // now so symex sees its targets; otherwise we leave this until
858
+ // process_goto_functions, as we haven't run remove_exceptions yet, and that
859
+ // pass alters the CFG.
860
+ if (using_symex_driven_loading)
861
+ {
862
+ // label the assertions
863
+ label_properties (goto_function.body );
867
864
868
- goto_function.body .update ();
869
- function.compute_location_numbers ();
870
- goto_function.body .compute_loop_numbers ();
871
- }
865
+ goto_function.body .update ();
866
+ function.compute_location_numbers ();
867
+ goto_function.body .compute_loop_numbers ();
872
868
}
873
869
}
874
870
@@ -930,96 +926,94 @@ bool jbmc_parse_optionst::process_goto_functions(
930
926
goto_modelt &goto_model,
931
927
const optionst &options)
932
928
{
933
- {
934
- log.status () << " Running GOTO functions transformation passes"
935
- << messaget::eom;
929
+ log.status () << " Running GOTO functions transformation passes"
930
+ << messaget::eom;
936
931
937
- bool using_symex_driven_loading =
938
- options.get_bool_option (" symex-driven-lazy-loading" );
932
+ bool using_symex_driven_loading =
933
+ options.get_bool_option (" symex-driven-lazy-loading" );
939
934
940
- // When using symex-driven lazy loading, *all* relevant processing is done
941
- // during process_goto_function, so we have nothing to do here.
942
- if (using_symex_driven_loading)
943
- return false ;
935
+ // When using symex-driven lazy loading, *all* relevant processing is done
936
+ // during process_goto_function, so we have nothing to do here.
937
+ if (using_symex_driven_loading)
938
+ return false ;
944
939
945
- // remove catch and throw
946
- remove_exceptions (
947
- goto_model, *class_hierarchy.get (), log.get_message_handler ());
940
+ // remove catch and throw
941
+ remove_exceptions (
942
+ goto_model, *class_hierarchy.get (), log.get_message_handler ());
948
943
949
- // instrument library preconditions
950
- instrument_preconditions (goto_model);
944
+ // instrument library preconditions
945
+ instrument_preconditions (goto_model);
951
946
952
- // ignore default/user-specified initialization
953
- // of variables with static lifetime
954
- if (cmdline.isset (" nondet-static" ))
955
- {
956
- log.status () << " Adding nondeterministic initialization "
957
- " of static/global variables"
958
- << messaget::eom;
959
- nondet_static (goto_model);
960
- }
947
+ // ignore default/user-specified initialization
948
+ // of variables with static lifetime
949
+ if (cmdline.isset (" nondet-static" ))
950
+ {
951
+ log.status () << " Adding nondeterministic initialization "
952
+ " of static/global variables"
953
+ << messaget::eom;
954
+ nondet_static (goto_model);
955
+ }
961
956
962
- // recalculate numbers, etc.
963
- goto_model.goto_functions .update ();
957
+ // recalculate numbers, etc.
958
+ goto_model.goto_functions .update ();
964
959
965
- if (cmdline.isset (" drop-unused-functions" ))
966
- {
967
- // Entry point will have been set before and function pointers removed
968
- log.status () << " Removing unused functions" << messaget::eom;
969
- remove_unused_functions (goto_model, log.get_message_handler ());
970
- }
960
+ if (cmdline.isset (" drop-unused-functions" ))
961
+ {
962
+ // Entry point will have been set before and function pointers removed
963
+ log.status () << " Removing unused functions" << messaget::eom;
964
+ remove_unused_functions (goto_model, log.get_message_handler ());
965
+ }
971
966
972
- // remove skips such that trivial GOTOs are deleted
973
- remove_skip (goto_model);
967
+ // remove skips such that trivial GOTOs are deleted
968
+ remove_skip (goto_model);
974
969
975
- // label the assertions
976
- // This must be done after adding assertions and
977
- // before using the argument of the "property" option.
978
- // Do not re-label after using the property slicer because
979
- // this would cause the property identifiers to change.
980
- label_properties (goto_model);
981
-
982
- // reachability slice?
983
- if (cmdline.isset (" reachability-slice-fb" ))
984
- {
985
- if (cmdline.isset (" reachability-slice" ))
986
- {
987
- log.error () << " --reachability-slice and --reachability-slice-fb "
988
- << " must not be given together" << messaget::eom;
989
- return true ;
990
- }
991
-
992
- log.status () << " Performing a forwards-backwards reachability slice"
993
- << messaget::eom;
994
- if (cmdline.isset (" property" ))
995
- reachability_slicer (goto_model, cmdline.get_values (" property" ), true );
996
- else
997
- reachability_slicer (goto_model, true );
998
- }
970
+ // label the assertions
971
+ // This must be done after adding assertions and
972
+ // before using the argument of the "property" option.
973
+ // Do not re-label after using the property slicer because
974
+ // this would cause the property identifiers to change.
975
+ label_properties (goto_model);
999
976
977
+ // reachability slice?
978
+ if (cmdline.isset (" reachability-slice-fb" ))
979
+ {
1000
980
if (cmdline.isset (" reachability-slice" ))
1001
981
{
1002
- log.status () << " Performing a reachability slice" << messaget::eom;
1003
- if (cmdline.isset (" property" ))
1004
- reachability_slicer (goto_model, cmdline.get_values (" property" ));
1005
- else
1006
- reachability_slicer (goto_model);
982
+ log.error () << " --reachability-slice and --reachability-slice-fb "
983
+ << " must not be given together" << messaget::eom;
984
+ return true ;
1007
985
}
1008
986
1009
- // full slice?
1010
- if (cmdline.isset (" full-slice" ))
1011
- {
1012
- log.status () << " Performing a full slice" << messaget::eom;
1013
- if (cmdline.isset (" property" ))
1014
- property_slicer (goto_model, cmdline.get_values (" property" ));
1015
- else
1016
- full_slicer (goto_model);
1017
- }
987
+ log.status () << " Performing a forwards-backwards reachability slice"
988
+ << messaget::eom;
989
+ if (cmdline.isset (" property" ))
990
+ reachability_slicer (goto_model, cmdline.get_values (" property" ), true );
991
+ else
992
+ reachability_slicer (goto_model, true );
993
+ }
994
+
995
+ if (cmdline.isset (" reachability-slice" ))
996
+ {
997
+ log.status () << " Performing a reachability slice" << messaget::eom;
998
+ if (cmdline.isset (" property" ))
999
+ reachability_slicer (goto_model, cmdline.get_values (" property" ));
1000
+ else
1001
+ reachability_slicer (goto_model);
1002
+ }
1018
1003
1019
- // remove any skips introduced
1020
- remove_skip (goto_model);
1004
+ // full slice?
1005
+ if (cmdline.isset (" full-slice" ))
1006
+ {
1007
+ log.status () << " Performing a full slice" << messaget::eom;
1008
+ if (cmdline.isset (" property" ))
1009
+ property_slicer (goto_model, cmdline.get_values (" property" ));
1010
+ else
1011
+ full_slicer (goto_model);
1021
1012
}
1022
1013
1014
+ // remove any skips introduced
1015
+ remove_skip (goto_model);
1016
+
1023
1017
return false ;
1024
1018
}
1025
1019
0 commit comments