Skip to content

Commit 48a2692

Browse files
committed
remove goto_programt::set_function_call
This removes the deprecated goto_programt::set_function_call method, along with the two remaining uses.
1 parent a76195a commit 48a2692

File tree

4 files changed

+19
-39
lines changed

4 files changed

+19
-39
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
@@ -399,20 +399,6 @@ class goto_programt
399399
return to_code_function_call(code).arguments();
400400
}
401401

402-
/// Set the function call for FUNCTION_CALL
403-
#if 1
404-
DEPRECATED(SINCE(
405-
2021,
406-
2,
407-
24,
408-
"Use call_function(), call_lhs(), call_arguments() instead"))
409-
void set_function_call(code_function_callt c)
410-
{
411-
PRECONDITION(is_function_call());
412-
code = std::move(c);
413-
}
414-
#endif
415-
416402
/// Get the statement for OTHER
417403
const codet &get_other() const
418404
{

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,20 @@ class remove_virtual_functionst
9393
/// \param function_symbol: the function to be called
9494
/// \param ns: namespace
9595
static void create_static_function_call(
96-
code_function_callt &call,
96+
goto_programt::instructiont &call,
9797
const symbol_exprt &function_symbol,
9898
const namespacet &ns)
9999
{
100-
call.function() = function_symbol;
100+
call.call_function() = function_symbol;
101+
101102
// Cast the pointers to the correct type for the new callee:
102103
// Note the `this` pointer is expected to change type, but other pointers
103104
// could also change due to e.g. using a different alias to refer to the same
104105
// type (in Java, for example, we see ArrayList.add(ArrayList::E arg)
105106
// overriding Collection.add(Collection::E arg))
106107
const auto &callee_parameters =
107108
to_code_type(ns.lookup(function_symbol.get_identifier()).type).parameters();
108-
auto &call_args = call.arguments();
109+
auto &call_args = call.call_arguments();
109110

110111
INVARIANT(
111112
callee_parameters.size() == call_args.size(),
@@ -288,11 +289,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
288289
remove_skip(goto_program, target, next_target);
289290
}
290291
else
291-
{
292-
auto c = target->get_function_call();
293-
create_static_function_call(c, *functions.front().symbol_expr, ns);
294-
target->set_function_call(c);
295-
}
292+
create_static_function_call(*target, *functions.front().symbol_expr, ns);
293+
296294
return next_target;
297295
}
298296

@@ -361,13 +359,11 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
361359
{
362360
if(fun.symbol_expr.has_value())
363361
{
364-
// call function
365-
auto new_call = code;
362+
auto new_call = *target; // copy
366363

367364
create_static_function_call(new_call, *fun.symbol_expr, ns);
368365

369-
goto_programt::targett t1 = new_code_calls.add(
370-
goto_programt::make_function_call(new_call, vcall_source_loc));
366+
goto_programt::targett t1 = new_code_calls.add(std::move(new_call));
371367

372368
insertit.first->second = t1;
373369
}

0 commit comments

Comments
 (0)