File tree 3 files changed +16
-9
lines changed
3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ void goto_unwindt::unwind(
244
244
goto_programt::targett t_goto=goto_program.insert_before (loop_exit);
245
245
unwind_log.insert (t_goto, loop_exit->location_number );
246
246
247
- t_goto->make_goto (get_mutable ( goto_program, loop_exit));
247
+ t_goto->make_goto (goto_program. const_cast_target ( loop_exit));
248
248
t_goto->source_location =loop_exit->source_location ;
249
249
t_goto->function =loop_exit->function ;
250
250
t_goto->guard =true_exprt ();
@@ -269,7 +269,8 @@ void goto_unwindt::unwind(
269
269
270
270
// re-direct any branches that go to loop_head to loop_iter
271
271
272
- for (goto_programt::targett t=get_mutable (goto_program, loop_head);
272
+ for (goto_programt::targett
273
+ t=goto_program.const_cast_target (loop_head);
273
274
t!=loop_iter; t++)
274
275
{
275
276
if (!t->is_goto ())
Original file line number Diff line number Diff line change @@ -117,13 +117,6 @@ class goto_unwindt
117
117
const goto_programt::const_targett start,
118
118
const goto_programt::const_targett end, // exclusive
119
119
goto_programt &goto_program); // result
120
-
121
- goto_programt::targett get_mutable (
122
- goto_programt &goto_program,
123
- const goto_programt::const_targett t) const
124
- {
125
- return goto_program.instructions .erase (t, t);
126
- }
127
120
};
128
121
129
122
#endif // CPROVER_GOTO_INSTRUMENT_UNWIND_H
Original file line number Diff line number Diff line change @@ -248,6 +248,19 @@ class goto_program_templatet
248
248
// ! The list of instructions in the goto program
249
249
instructionst instructions;
250
250
251
+ // Convert a const_targett to a targett - use with care and avoid
252
+ // whenever possible
253
+ targett const_cast_target (const_targett t)
254
+ {
255
+ return instructions.erase (t, t);
256
+ }
257
+
258
+ // Dummy for templates with possible const contexts
259
+ const_targett const_cast_target (const_targett t) const
260
+ {
261
+ return t;
262
+ }
263
+
251
264
void get_successors (
252
265
targett target,
253
266
targetst &successors);
You can’t perform that action at this time.
0 commit comments