@@ -89,12 +89,12 @@ void reachability_slicert::fixedpoint_to_assertions(
89
89
{
90
90
// This is an end-of-function -> successor-of-callsite edge.
91
91
// Queue both the caller and the end of the callee.
92
- if ( std::prev (node. PC )-> is_function_call ())
93
- {
94
- stack. emplace_back (edge. first , true );
95
- stack. emplace_back (
96
- cfg. entry_map [ std::prev (node. PC )], caller_is_known );
97
- }
92
+ INVARIANT (
93
+ std::prev (node. PC )-> is_function_call (),
94
+ " all function return edges should point to the successor of a "
95
+ " FUNCTION_CALL instruction " );
96
+ stack. emplace_back (edge. first , true );
97
+ stack. emplace_back (cfg. entry_map [ std::prev (node. PC )], caller_is_known);
98
98
}
99
99
else if (pred_node.PC ->is_function_call ())
100
100
{
@@ -200,7 +200,6 @@ void reachability_slicert::slice(goto_functionst &goto_functions)
200
200
!e.reaches_assertion && !e.reachable_from_assertion &&
201
201
!i_it->is_end_function ())
202
202
i_it->make_assumption (false_exprt ());
203
- e.reaches_assertion = e.reachable_from_assertion = false ;
204
203
}
205
204
206
205
// replace unreachable code by skip
@@ -245,21 +244,20 @@ void reachability_slicer(
245
244
246
245
// / Perform reachability slicing on goto_model for selected functions.
247
246
// / \param goto_model Goto program to slice
248
- // / \param functions The functions relevant for the slicing (i.e. starting
247
+ // / \param functions_list The functions relevant for the slicing (i.e. starting
249
248
// / point for the search in the cfg). Anything that is reachable in the CFG
250
249
// / starting from these functions will be kept.
251
250
void function_path_reachability_slicer (
252
251
goto_modelt &goto_model,
253
252
const std::string &functions_list)
254
253
{
255
- reachability_slicert s;
256
-
257
- std::istringstream multiple_functions (functions_list);
254
+ std::istringstream functions_stream (functions_list);
258
255
std::string single_function;
259
- while (std::getline (multiple_functions , single_function, ' ,' ))
256
+ while (std::getline (functions_stream , single_function, ' ,' ))
260
257
{
261
- in_function_criteriont p (single_function);
262
- s (goto_model.goto_functions , p, true );
258
+ in_function_criteriont matching_criterion (single_function);
259
+ reachability_slicert slicer;
260
+ slicer (goto_model.goto_functions , matching_criterion, true );
263
261
}
264
262
265
263
remove_calls_no_bodyt remove_calls_no_body;
0 commit comments