Skip to content

remove deprecated goto_instructiont::get_function_call #6391

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 18, 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
12 changes: 5 additions & 7 deletions src/goto-analyzer/taint_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ void taint_analysist::instrument(

if(instruction.is_function_call())
{
const code_function_callt &function_call =
instruction.get_function_call();
const exprt &function = function_call.function();
const exprt &function = instruction.call_function();

if(function.id() == ID_symbol)
{
Expand Down Expand Up @@ -144,18 +142,18 @@ void taint_analysist::instrument(
{
unsigned nr =
have_this ? rule.parameter_number : rule.parameter_number - 1;
if(function_call.arguments().size() > nr)
where = function_call.arguments()[nr];
if(instruction.call_arguments().size() > nr)
where = instruction.call_arguments()[nr];
break;
}

case taint_parse_treet::rulet::THIS:
if(have_this)
{
DATA_INVARIANT(
!function_call.arguments().empty(),
!instruction.call_arguments().empty(),
"`this` implies at least one argument in function call");
where = function_call.arguments()[0];
where = instruction.call_arguments()[0];
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/goto-instrument/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ void dott::write_dot_subgraph(
tmp.str("Atomic End");
else if(it->is_function_call())
{
const auto &function_call = it->get_function_call();
const code_function_callt function_call(
it->call_lhs(), it->call_function(), it->call_arguments());
std::string t = from_expr(ns, function_id, function_call);
while(t[ t.size()-1 ]=='\n')
t = t.substr(0, t.size()-1);
Expand Down
24 changes: 15 additions & 9 deletions src/goto-instrument/goto_program2code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ goto_programt::const_targett goto_program2codet::convert_instruction(
return target;

case FUNCTION_CALL:
dest.add(target->get_function_call());
{
code_function_callt call(
target->call_lhs(), target->call_function(), target->call_arguments());
dest.add(call);
}
return target;

case OTHER:
Expand Down Expand Up @@ -465,8 +469,7 @@ goto_programt::const_targett goto_program2codet::convert_decl(
!next->is_target() &&
(next->is_assign() || next->is_function_call()))
{
exprt lhs =
next->is_assign() ? next->assign_lhs() : next->get_function_call().lhs();
exprt lhs = next->is_assign() ? next->assign_lhs() : next->call_lhs();
if(lhs==symbol &&
va_list_expr.find(lhs)==va_list_expr.end())
{
Expand All @@ -477,9 +480,11 @@ goto_programt::const_targett goto_program2codet::convert_decl(
else
{
// could hack this by just erasing the first operand
const code_function_callt &f = next->get_function_call();
side_effect_expr_function_callt call(
f.function(), f.arguments(), typet{}, source_locationt{});
next->call_function(),
next->call_arguments(),
typet{},
source_locationt{});
d.copy_to_operands(call);
}

Expand Down Expand Up @@ -1299,15 +1304,16 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
thread_start->call_arguments().size() == 1 &&
after_thread_start == thread_end)
{
const code_function_callt &cf = thread_start->get_function_call();

system_headers.insert("pthread.h");

const null_pointer_exprt n(pointer_type(empty_typet()));
dest.add(code_function_callt(
cf.lhs(),
thread_start->call_lhs(),
symbol_exprt("pthread_create", code_typet({}, empty_typet())),
{n, n, cf.function(), cf.arguments().front()}));
{n,
n,
thread_start->call_function(),
thread_start->call_arguments().front()}));

return thread_end;
}
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 @@ -271,20 +271,6 @@ class goto_programt
return to_code_return(code).return_value();
}

/// Get the function call for FUNCTION_CALL
#if 1
DEPRECATED(SINCE(
2021,
2,
24,
"Use call_function(), call_lhs(), call_arguments() instead"))
const code_function_callt &get_function_call() const
{
PRECONDITION(is_function_call());
return to_code_function_call(code);
}
#endif

/// Get the function that is called for FUNCTION_CALL
const exprt &call_function() const
{
Expand Down
6 changes: 4 additions & 2 deletions src/goto-programs/remove_virtual_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
}
else
{
auto c = target->get_function_call();
auto c = code_function_callt(
target->call_lhs(), target->call_function(), target->call_arguments());
create_static_function_call(c, *functions.front().symbol_expr, ns);
target->call_function() = c.function();
target->call_arguments() = c.arguments();
Expand All @@ -299,7 +300,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(

const auto &vcall_source_loc=target->source_location;

code_function_callt code(target->get_function_call());
code_function_callt code(
target->call_lhs(), target->call_function(), target->call_arguments());
goto_programt new_code_for_this_argument;

process_this_argument(
Expand Down
6 changes: 3 additions & 3 deletions src/goto-programs/restrict_function_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ void restrict_function_pointer(

// Check if this is calling a function pointer, and if so if it is one
// we have a restriction for
const auto &original_function_call = location->get_function_call();
const auto &original_function = location->call_function();

if(!can_cast_expr<dereference_exprt>(original_function_call.function()))
if(!can_cast_expr<dereference_exprt>(original_function))
return;

// because we run the label function pointer calls transformation pass before
// this stage a dereference can only dereference a symbol expression
auto const &called_function_pointer =
to_dereference_expr(original_function_call.function()).pointer();
to_dereference_expr(original_function).pointer();
PRECONDITION(can_cast_expr<symbol_exprt>(called_function_pointer));
auto const &pointer_symbol = to_symbol_expr(called_function_pointer);
auto const restriction_iterator =
Expand Down
11 changes: 7 additions & 4 deletions src/goto-symex/symex_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ void goto_symext::print_symex_step(statet &state)
print_callstack_entry(state.source) << messaget::eom;

// Add the method we're about to enter with no location number.
log.status() << format(state.source.pc->get_function_call().function())
<< messaget::eom << messaget::eom;
log.status() << format(state.source.pc->call_function()) << messaget::eom
<< messaget::eom;
}
}
}
Expand Down Expand Up @@ -675,8 +675,11 @@ void goto_symext::execute_next_instruction(
case FUNCTION_CALL:
if(state.reachable)
{
symex_function_call(
get_goto_function, state, instruction.get_function_call());
code_function_callt call(
instruction.call_lhs(),
instruction.call_function(),
instruction.call_arguments());
symex_function_call(get_goto_function, state, call);
}
else
symex_transition(state);
Expand Down