Skip to content

Commit 39685c7

Browse files
authored
Merge pull request #6384 from diffblue/set_function_call
remove goto_programt::set_function_call
2 parents a80fe1f + 2d70e80 commit 39685c7

File tree

4 files changed

+13
-28
lines changed

4 files changed

+13
-28
lines changed

src/goto-analyzer/static_simplifier.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,23 @@ bool static_simplifier(
125125
}
126126
else if(i_it->is_function_call())
127127
{
128-
auto fcall = i_it->get_function_call();
128+
// copy
129+
auto call_function = as_const(*i_it).call_function();
130+
auto call_arguments = as_const(*i_it).call_arguments();
129131

130132
bool unchanged =
131-
ai.abstract_state_before(i_it)->ai_simplify(fcall.function(), ns);
133+
ai.abstract_state_before(i_it)->ai_simplify(call_function, ns);
132134

133-
exprt::operandst &args=fcall.arguments();
134-
135-
for(auto &o : args)
135+
for(auto &o : call_arguments)
136136
unchanged &= ai.abstract_state_before(i_it)->ai_simplify(o, ns);
137137

138138
if(unchanged)
139139
unmodified.function_calls++;
140140
else
141141
{
142142
simplified.function_calls++;
143-
i_it->set_function_call(fcall);
143+
i_it->call_function() = std::move(call_function);
144+
i_it->call_arguments() = std::move(call_arguments);
144145
}
145146
}
146147
}

src/goto-instrument/replace_calls.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ void replace_callst::operator()(
7070
if(!ins.is_function_call())
7171
continue;
7272

73-
auto cfc = ins.get_function_call();
74-
exprt &function = cfc.function();
73+
const exprt &function = ins.call_function();
7574

7675
PRECONDITION(function.id() == ID_symbol);
7776

78-
symbol_exprt &se = to_symbol_expr(function);
77+
const symbol_exprt &se = to_symbol_expr(function);
7978
const irep_idt &id = se.get_identifier();
8079

8180
auto f_it1 = goto_functions.function_map.find(id);
@@ -109,10 +108,8 @@ void replace_callst::operator()(
109108
}
110109

111110
// Finally modify the call
112-
function.type() = ns.lookup(f_it2->first).type;
113-
se.set_identifier(new_id);
114-
115-
ins.set_function_call(cfc);
111+
ins.call_function().type() = ns.lookup(f_it2->first).type;
112+
to_symbol_expr(ins.call_function()).set_identifier(new_id);
116113
}
117114
}
118115

src/goto-programs/goto_program.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,6 @@ class goto_programt
327327
return to_code_function_call(code).arguments();
328328
}
329329

330-
/// Set the function call for FUNCTION_CALL
331-
#if 1
332-
DEPRECATED(SINCE(
333-
2021,
334-
2,
335-
24,
336-
"Use call_function(), call_lhs(), call_arguments() instead"))
337-
void set_function_call(code_function_callt c)
338-
{
339-
PRECONDITION(is_function_call());
340-
code = std::move(c);
341-
}
342-
#endif
343-
344330
/// Get the statement for OTHER
345331
const codet &get_other() const
346332
{

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
291291
{
292292
auto c = target->get_function_call();
293293
create_static_function_call(c, *functions.front().symbol_expr, ns);
294-
target->set_function_call(c);
294+
target->call_function() = c.function();
295+
target->call_arguments() = c.arguments();
295296
}
296297
return next_target;
297298
}

0 commit comments

Comments
 (0)