Skip to content

remove goto_programt::set_function_call #6384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/goto-analyzer/static_simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,23 @@ bool static_simplifier(
}
else if(i_it->is_function_call())
{
auto fcall = i_it->get_function_call();
// copy
auto call_function = as_const(*i_it).call_function();
auto call_arguments = as_const(*i_it).call_arguments();

bool unchanged =
ai.abstract_state_before(i_it)->ai_simplify(fcall.function(), ns);
ai.abstract_state_before(i_it)->ai_simplify(call_function, ns);

exprt::operandst &args=fcall.arguments();

for(auto &o : args)
for(auto &o : call_arguments)
unchanged &= ai.abstract_state_before(i_it)->ai_simplify(o, ns);

if(unchanged)
unmodified.function_calls++;
else
{
simplified.function_calls++;
i_it->set_function_call(fcall);
i_it->call_function() = std::move(call_function);
i_it->call_arguments() = std::move(call_arguments);
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/goto-instrument/replace_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ void replace_callst::operator()(
if(!ins.is_function_call())
continue;

auto cfc = ins.get_function_call();
exprt &function = cfc.function();
const exprt &function = ins.call_function();

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

symbol_exprt &se = to_symbol_expr(function);
const symbol_exprt &se = to_symbol_expr(function);
const irep_idt &id = se.get_identifier();

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

// Finally modify the call
function.type() = ns.lookup(f_it2->first).type;
se.set_identifier(new_id);

ins.set_function_call(cfc);
ins.call_function().type() = ns.lookup(f_it2->first).type;
to_symbol_expr(ins.call_function()).set_identifier(new_id);
}
}

Expand Down
14 changes: 0 additions & 14 deletions src/goto-programs/goto_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,6 @@ class goto_programt
return to_code_function_call(code).arguments();
}

/// Set the function call for FUNCTION_CALL
#if 1
DEPRECATED(SINCE(
2021,
2,
24,
"Use call_function(), call_lhs(), call_arguments() instead"))
void set_function_call(code_function_callt c)
{
PRECONDITION(is_function_call());
code = std::move(c);
}
#endif

/// Get the statement for OTHER
const codet &get_other() const
{
Expand Down
3 changes: 2 additions & 1 deletion src/goto-programs/remove_virtual_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
{
auto c = target->get_function_call();
create_static_function_call(c, *functions.front().symbol_expr, ns);
target->set_function_call(c);
target->call_function() = c.function();
target->call_arguments() = c.arguments();
}
return next_target;
}
Expand Down