@@ -256,16 +256,12 @@ void dfcc_instrumentt::instrument_harness_function(
256
256
// create a local write set symbol
257
257
const auto &function_symbol =
258
258
dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id);
259
- const auto &write_set = dfcc_utilst::create_symbol (
260
- goto_model.symbol_table ,
261
- library.dfcc_type [dfcc_typet::WRITE_SET_PTR],
262
- function_id,
263
- " __write_set_to_check" ,
264
- function_symbol.location ,
265
- function_symbol.mode ,
266
- function_symbol.module ,
267
- false )
268
- .symbol_expr ();
259
+ const auto write_set = dfcc_utilst::create_symbol (
260
+ goto_model.symbol_table ,
261
+ library.dfcc_type [dfcc_typet::WRITE_SET_PTR],
262
+ function_id,
263
+ " __write_set_to_check" ,
264
+ function_symbol.location );
269
265
270
266
std::set<symbol_exprt> local_statics = get_local_statics (function_id);
271
267
@@ -663,16 +659,15 @@ void dfcc_instrumentt::instrument_lhs(
663
659
goto_programt &goto_program,
664
660
dfcc_cfg_infot &cfg_info)
665
661
{
666
- const auto &mode =
667
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id).mode ;
668
-
669
662
goto_programt payload;
670
663
671
664
const auto &lhs_source_location = target->source_location ();
672
665
auto &write_set = cfg_info.get_write_set (target);
673
666
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
674
667
dfcc_utilst::make_null_check_expr (write_set), lhs_source_location));
675
668
669
+ const irep_idt &mode =
670
+ dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id).mode ;
676
671
source_locationt check_source_location (target->source_location ());
677
672
check_source_location.set_property_class (" assigns" );
678
673
check_source_location.set_comment (
@@ -691,18 +686,12 @@ void dfcc_instrumentt::instrument_lhs(
691
686
// ASSIGN lhs := rhs;
692
687
// ```
693
688
694
- auto &check_sym = dfcc_utilst::create_symbol (
689
+ const auto check_var = dfcc_utilst::create_symbol (
695
690
goto_model.symbol_table ,
696
691
bool_typet (),
697
- id2string ( function_id) ,
692
+ function_id,
698
693
" __check_lhs_assignment" ,
699
- lhs_source_location,
700
- mode,
701
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id)
702
- .module ,
703
- false );
704
-
705
- const auto &check_var = check_sym.symbol_expr ();
694
+ lhs_source_location);
706
695
707
696
payload.add (goto_programt::make_decl (check_var, lhs_source_location));
708
697
@@ -950,22 +939,17 @@ void dfcc_instrumentt::instrument_deallocate_call(
950
939
// ----
951
940
// CALL __CPROVER_deallocate(ptr);
952
941
// ```
953
- const auto &mode =
954
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id).mode ;
955
942
goto_programt payload;
956
943
957
944
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
958
945
dfcc_utilst::make_null_check_expr (write_set), target_location));
959
946
960
- auto &check_sym = get_fresh_aux_symbol (
947
+ const auto check_var = dfcc_utilst::create_symbol (
948
+ goto_model.symbol_table ,
961
949
bool_typet (),
962
- id2string ( function_id) ,
950
+ function_id,
963
951
" __check_deallocate" ,
964
- target_location,
965
- mode,
966
- goto_model.symbol_table );
967
-
968
- const auto &check_var = check_sym.symbol_expr ();
952
+ target_location);
969
953
970
954
payload.add (goto_programt::make_decl (check_var, target_location));
971
955
@@ -977,6 +961,8 @@ void dfcc_instrumentt::instrument_deallocate_call(
977
961
target_location));
978
962
979
963
// add property class on assertion source_location
964
+ const irep_idt &mode =
965
+ dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id).mode ;
980
966
source_locationt check_location (target_location);
981
967
check_location.set_property_class (" frees" );
982
968
std::string comment =
@@ -1040,6 +1026,8 @@ void dfcc_instrumentt::instrument_other(
1040
1026
const auto &target_location = target->source_location ();
1041
1027
auto &statement = target->get_other ().get_statement ();
1042
1028
auto &write_set = cfg_info.get_write_set (target);
1029
+ const irep_idt &mode =
1030
+ dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id).mode ;
1043
1031
1044
1032
if (statement == ID_array_set || statement == ID_array_copy)
1045
1033
{
@@ -1054,23 +1042,17 @@ void dfcc_instrumentt::instrument_other(
1054
1042
// ----
1055
1043
// OTHER {statement = array_set, args = {dest, value}};
1056
1044
// ```
1057
- const auto &mode =
1058
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id)
1059
- .mode ;
1060
1045
goto_programt payload;
1061
1046
1062
1047
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
1063
1048
dfcc_utilst::make_null_check_expr (write_set), target_location));
1064
1049
1065
- auto &check_sym = get_fresh_aux_symbol (
1050
+ const auto check_var = dfcc_utilst::create_symbol (
1051
+ goto_model.symbol_table ,
1066
1052
bool_typet (),
1067
- id2string ( function_id) ,
1053
+ function_id,
1068
1054
is_array_set ? " __check_array_set" : " __check_array_copy" ,
1069
- target_location,
1070
- mode,
1071
- goto_model.symbol_table );
1072
-
1073
- const auto &check_var = check_sym.symbol_expr ();
1055
+ target_location);
1074
1056
1075
1057
payload.add (goto_programt::make_decl (check_var, target_location));
1076
1058
@@ -1115,23 +1097,17 @@ void dfcc_instrumentt::instrument_other(
1115
1097
// ----
1116
1098
// OTHER {statement = array_replace, args = {dest, src}};
1117
1099
// ```
1118
- const auto &mode =
1119
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id)
1120
- .mode ;
1121
1100
goto_programt payload;
1122
1101
1123
1102
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
1124
1103
dfcc_utilst::make_null_check_expr (write_set), target_location));
1125
1104
1126
- auto &check_sym = get_fresh_aux_symbol (
1105
+ const auto check_var = dfcc_utilst::create_symbol (
1106
+ goto_model.symbol_table ,
1127
1107
bool_typet (),
1128
- id2string ( function_id) ,
1108
+ function_id,
1129
1109
" __check_array_replace" ,
1130
- target_location,
1131
- mode,
1132
- goto_model.symbol_table );
1133
-
1134
- const auto &check_var = check_sym.symbol_expr ();
1110
+ target_location);
1135
1111
1136
1112
payload.add (goto_programt::make_decl (check_var, target_location));
1137
1113
@@ -1170,23 +1146,17 @@ void dfcc_instrumentt::instrument_other(
1170
1146
// ASSERT(check_havoc_object);
1171
1147
// DEAD check_havoc_object;
1172
1148
// ```
1173
- const auto &mode =
1174
- dfcc_utilst::get_function_symbol (goto_model.symbol_table , function_id)
1175
- .mode ;
1176
1149
goto_programt payload;
1177
1150
1178
1151
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
1179
1152
dfcc_utilst::make_null_check_expr (write_set), target_location));
1180
1153
1181
- auto &check_sym = get_fresh_aux_symbol (
1154
+ const auto check_var = dfcc_utilst::create_symbol (
1155
+ goto_model.symbol_table ,
1182
1156
bool_typet (),
1183
- id2string ( function_id) ,
1157
+ function_id,
1184
1158
" __check_havoc_object" ,
1185
- target_location,
1186
- mode,
1187
- goto_model.symbol_table );
1188
-
1189
- const auto &check_var = check_sym.symbol_expr ();
1159
+ target_location);
1190
1160
1191
1161
payload.add (goto_programt::make_decl (check_var, target_location));
1192
1162
0 commit comments