Skip to content

Commit fca84ac

Browse files
authored
Merge pull request #4189 from diffblue/make_X_API_remove_virtual_functions
use instructiont::make_X in remove_virtual_functions
2 parents 5e69625 + eecb720 commit fca84ac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,24 +247,31 @@ goto_programt::targett remove_virtual_functionst::remove_virtual_function(
247247
// Only create one call sequence per possible target:
248248
if(insertit.second)
249249
{
250-
goto_programt::targett t1=new_code_calls.add_instruction();
251250
if(fun.symbol_expr.has_value())
252251
{
253252
// call function
254-
*t1 = goto_programt::make_function_call(code, vcall_source_loc);
253+
goto_programt::targett t1 = new_code_calls.add(
254+
goto_programt::make_function_call(code, vcall_source_loc));
255+
255256
create_static_function_call(
256257
t1->get_function_call(), *fun.symbol_expr, ns);
258+
259+
insertit.first->second = t1;
257260
}
258261
else
259262
{
263+
goto_programt::targett t1 = new_code_calls.add(
264+
goto_programt::make_assertion(false_exprt(), vcall_source_loc));
265+
260266
// No definition for this type; shouldn't be possible...
261-
*t1 = goto_programt::make_assertion(false_exprt(), vcall_source_loc);
262267
t1->source_location.set_comment(
263268
"cannot find calls for " +
264269
id2string(code.function().get(ID_identifier)) + " dispatching " +
265270
id2string(fun.class_id));
271+
272+
insertit.first->second = t1;
266273
}
267-
insertit.first->second=t1;
274+
268275
// goto final
269276
new_code_calls.add(
270277
goto_programt::make_goto(t_final, true_exprt(), vcall_source_loc));

0 commit comments

Comments
 (0)