@@ -18,6 +18,7 @@ Author: Peter Schrammel
18
18
#include < util/cprover_prefix.h>
19
19
#include < util/expr_initializer.h>
20
20
#include < util/find_symbols.h>
21
+ #include < util/format_expr.h>
21
22
#include < util/fresh_symbol.h>
22
23
#include < util/invariant.h>
23
24
#include < util/message.h>
@@ -94,10 +95,10 @@ void goto_symext::initialize_shadow_memory(
94
95
95
96
log .conditional_output (
96
97
log .debug (),
97
- [field, field_pair, this , address_expr](messaget::mstreamt &mstream) {
98
+ [field, field_pair, address_expr](messaget::mstreamt &mstream) {
98
99
mstream << " Shadow memory: initialize field " << id2string (field.get_identifier ())
99
- << " for " << from_expr (ns, " " , address_expr)
100
- << " with initial value " << from_expr (ns, " " , field_pair.second )
100
+ << " for " << format ( address_expr)
101
+ << " with initial value " << format ( field_pair.second )
101
102
<< messaget::eom;
102
103
});
103
104
}
@@ -113,7 +114,7 @@ symbol_exprt goto_symext::add_field(
113
114
symbolt &new_symbol = get_fresh_aux_symbol (
114
115
field_type,
115
116
id2string (state.source .function_id ),
116
- " SM__" + from_expr (ns, " " , expr) + " __" + id2string (field_name),
117
+ " SM__" + from_expr (expr) + " __" + id2string (field_name),
117
118
state.source .pc ->source_location (),
118
119
ID_C,
119
120
state.symbol_table );
@@ -136,8 +137,8 @@ static bool set_field_check_null(
136
137
#ifdef DEBUG_SM
137
138
log .conditional_output (
138
139
log .debug (), [ns, null_pointer, expr](messaget::mstreamt &mstream) {
139
- mstream << " Shadow memory: value set match: " << from_expr (ns, " " , null_pointer)
140
- << " <-- " << from_expr (ns, " " , expr) << messaget::eom;
140
+ mstream << " Shadow memory: value set match: " << format ( null_pointer)
141
+ << " <-- " << format ( expr) << messaget::eom;
141
142
mstream << " Shadow memory: ignoring set field on NULL object" << messaget::eom;
142
143
});
143
144
#endif
@@ -158,7 +159,7 @@ static value_set_dereferencet::valuet get_shadow(
158
159
value_set_dereferencet::valuet shadow_dereference =
159
160
value_set_dereferencet::build_reference_to (shadowed_object, expr, ns);
160
161
#ifdef DEBUG_SM
161
- log .debug () << " Shadow memory: shadow-deref: " << from_expr (ns, " " , shadow_dereference.value ) << messaget::eom;
162
+ log .debug () << " Shadow memory: shadow-deref: " << format ( shadow_dereference.value ) << messaget::eom;
162
163
#endif
163
164
return shadow_dereference;
164
165
}
@@ -466,23 +467,23 @@ static optionalt<exprt> get_shadow_memory(
466
467
{
467
468
log .warning ()
468
469
<< " Shadow memory: value set contains unknown for "
469
- << from_expr (ns, " " , expr)
470
+ << format ( expr)
470
471
<< messaget::eom;
471
472
continue ;
472
473
}
473
474
if (to_object_descriptor_expr (matched_object).root_object ().id () == ID_integer_address)
474
475
{
475
476
log .warning ()
476
477
<< " Shadow memory: value set contains integer_address for "
477
- << from_expr (ns, " " , expr)
478
+ << format ( expr)
478
479
<< messaget::eom;
479
480
continue ;
480
481
}
481
482
if (matched_object.type ().get_bool (ID_C_is_failed_symbol))
482
483
{
483
484
log .warning ()
484
485
<< " Shadow memory: value set contains failed symbol for "
485
- << from_expr (ns, " " , expr)
486
+ << format ( expr)
486
487
<< messaget::eom;
487
488
continue ;
488
489
}
@@ -604,10 +605,10 @@ void goto_symext::symex_shadow_memory_copy(
604
605
return ;
605
606
}
606
607
log .conditional_output (
607
- log .debug (), [this , dest_expr, src_expr](messaget::mstreamt &mstream) {
608
+ log .debug (), [dest_expr, src_expr](messaget::mstreamt &mstream) {
608
609
mstream << " Shadow memory: copy from "
609
- << from_expr (ns, " " , src_expr.object ())
610
- << " to " << from_expr (ns, " " , dest_expr.object ())
610
+ << format ( src_expr.object ())
611
+ << " to " << format ( dest_expr.object ())
611
612
<< messaget::eom;
612
613
});
613
614
for (const auto &entry : state.address_fields )
@@ -625,7 +626,7 @@ void goto_symext::symex_shadow_memory_copy(
625
626
{
626
627
log .warning ()
627
628
<< " Shadow memory: cannot copy shadow memory to "
628
- << from_expr (ns, " " , dest_expr)
629
+ << format ( dest_expr)
629
630
<< messaget::eom;
630
631
continue ;
631
632
}
@@ -641,17 +642,17 @@ void goto_symext::symex_shadow_memory_copy(
641
642
{
642
643
log .warning ()
643
644
<< " Shadow memory: cannot copy shadow memory from "
644
- << from_expr (ns, " " , src_expr)
645
+ << format ( src_expr)
645
646
<< messaget::eom;
646
647
continue ;
647
648
}
648
649
if (maybe_lhs->id () == ID_address_of && maybe_rhs->id () == ID_address_of)
649
650
{
650
651
log .warning ()
651
652
<< " Shadow memory: copied shadow memory from "
652
- << from_expr (src_expr)
653
+ << format (src_expr)
653
654
<< " to "
654
- << from_expr (dest_expr)
655
+ << format (dest_expr)
655
656
<< messaget::eom;
656
657
symex_assign (
657
658
state,
@@ -662,9 +663,9 @@ void goto_symext::symex_shadow_memory_copy(
662
663
{
663
664
log .warning ()
664
665
<< " Shadow memory: failed to copy shadow memory from "
665
- << from_expr (ns, " " , src_expr)
666
+ << format ( src_expr)
666
667
<< " to "
667
- << from_expr (ns, " " , dest_expr)
668
+ << format ( dest_expr)
668
669
<< messaget::eom;
669
670
}
670
671
}
@@ -736,7 +737,7 @@ static std::vector<exprt::operandst> get_field(
736
737
{
737
738
std::stringstream s;
738
739
s << " Shadow memory: cannot get shadow memory via type void* for "
739
- << from_expr (ns, " " , expr)
740
+ << format ( expr)
740
741
<< " . Insert a cast to the type that you want to access." ;
741
742
throw invalid_input_exceptiont (s.str ());
742
743
}
@@ -857,13 +858,13 @@ void goto_symext::symex_set_field(
857
858
log .debug () << " Shadow memory: mux size set_field: " << mux_size << messaget::eom;
858
859
const exprt lhs = deref_expr (*maybe_lhs);
859
860
#ifdef DEBUG_SM
860
- log .debug () << " Shadow memory: LHS: " << from_expr (ns, " " , lhs) << messaget::eom;
861
+ log .debug () << " Shadow memory: LHS: " << format ( lhs) << messaget::eom;
861
862
#endif
862
863
if (lhs.type ().id () == ID_empty)
863
864
{
864
865
std::stringstream s;
865
866
s << " Shadow memory: cannot set shadow memory via type void* for "
866
- << from_expr (ns, " " , expr)
867
+ << format ( expr)
867
868
<< " . Insert a cast to the type that you want to access." ;
868
869
throw invalid_input_exceptiont (s.str ());
869
870
}
@@ -875,15 +876,15 @@ void goto_symext::symex_set_field(
875
876
CHECK_RETURN (per_byte_rhs.has_value ());
876
877
877
878
#ifdef DEBUG_SM
878
- log .debug () << " Shadow memory: RHS: " << from_expr (ns, " " , per_byte_rhs) << messaget::eom;
879
+ log .debug () << " Shadow memory: RHS: " << format ( per_byte_rhs. value () ) << messaget::eom;
879
880
#endif
880
881
symex_assign (state, lhs, typecast_exprt::conditional_cast (per_byte_rhs.value (), lhs.type ()));
881
882
}
882
883
else
883
884
{
884
885
log .warning ()
885
886
<< " Shadow memory: cannot set_field for "
886
- << from_expr (ns, " " , expr)
887
+ << format ( expr)
887
888
<< messaget::eom;
888
889
}
889
890
}
@@ -932,23 +933,23 @@ void goto_symext::symex_get_field(
932
933
{
933
934
log .warning ()
934
935
<< " Shadow memory: value set contains unknown for "
935
- << from_expr (ns, " " , expr)
936
+ << format ( expr)
936
937
<< messaget::eom;
937
938
continue ;
938
939
}
939
940
if (to_object_descriptor_expr (matched_object).root_object ().id () == ID_integer_address)
940
941
{
941
942
log .warning ()
942
943
<< " Shadow memory: value set contains integer_address for "
943
- << from_expr (ns, " " , expr)
944
+ << format ( expr)
944
945
<< messaget::eom;
945
946
continue ;
946
947
}
947
948
if (matched_object.type ().get_bool (ID_C_is_failed_symbol))
948
949
{
949
950
log .warning ()
950
951
<< " Shadow memory: value set contains failed symbol for "
951
- << from_expr (ns, " " , expr)
952
+ << format ( expr)
952
953
<< messaget::eom;
953
954
continue ;
954
955
}
@@ -972,7 +973,7 @@ void goto_symext::symex_get_field(
972
973
const size_t mux_size = rhs_conds_values.size () - 1 ;
973
974
log .debug () << " Shadow memory: mux size get_field: " << mux_size << messaget::eom;
974
975
#ifdef DEBUG_SM
975
- log .debug () << " Shadow memory: RHS: " << from_expr (ns, " " , rhs) << messaget::eom;
976
+ log .debug () << " Shadow memory: RHS: " << format ( rhs) << messaget::eom;
976
977
#endif
977
978
symex_assign (
978
979
state, lhs, typecast_exprt::conditional_cast (rhs, lhs.type ()));
@@ -981,7 +982,7 @@ void goto_symext::symex_get_field(
981
982
{
982
983
log .warning ()
983
984
<< " Shadow memory: cannot get_field for "
984
- << from_expr (ns, " " , expr)
985
+ << format ( expr)
985
986
<< messaget::eom;
986
987
symex_assign (
987
988
state, lhs, typecast_exprt::conditional_cast (field_init_expr, lhs.type ()));
0 commit comments