Skip to content

Commit 3981fb0

Browse files
committed
Add source locations to virt calls
This confers the source location belonging to a virtual call to the code implementing its expanded vtable.
1 parent 48f03aa commit 3981fb0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ void remove_virtual_functionst::remove_virtual_function(
104104
const code_function_callt &code=
105105
to_code_function_call(target->code);
106106

107+
const auto &vcall_source_loc=target->source_location;
108+
107109
const exprt &function=code.function();
108110
assert(function.id()==ID_virtual_function);
109111
assert(!code.arguments().empty());
@@ -133,6 +135,8 @@ void remove_virtual_functionst::remove_virtual_function(
133135
goto_programt final_skip;
134136

135137
goto_programt::targett t_final=final_skip.add_instruction();
138+
t_final->source_location=vcall_source_loc;
139+
136140
t_final->make_skip();
137141

138142
// build the calls and gotos
@@ -161,6 +165,7 @@ void remove_virtual_functionst::remove_virtual_function(
161165
if(insertit.second)
162166
{
163167
goto_programt::targett t1=new_code_calls.add_instruction();
168+
t1->source_location=vcall_source_loc;
164169
if(!fun.symbol_expr.get_identifier().empty())
165170
{
166171
// call function
@@ -179,6 +184,7 @@ void remove_virtual_functionst::remove_virtual_function(
179184
insertit.first->second=t1;
180185
// goto final
181186
goto_programt::targett t3=new_code_calls.add_instruction();
187+
t3->source_location=vcall_source_loc;
182188
t3->make_goto(t_final, true_exprt());
183189
}
184190

@@ -188,6 +194,7 @@ void remove_virtual_functionst::remove_virtual_function(
188194
{
189195
exprt c_id1=constant_exprt(fun.class_id, string_typet());
190196
goto_programt::targett t4=new_code_gotos.add_instruction();
197+
t4->source_location=vcall_source_loc;
191198
t4->make_goto(insertit.first->second, equal_exprt(c_id1, c_id2));
192199
}
193200
}

0 commit comments

Comments
 (0)