Skip to content

Commit 038a53b

Browse files
authored
Merge pull request #6391 from diffblue/get_function_call
remove deprecated goto_instructiont::get_function_call
2 parents 7727f45 + a375eff commit 038a53b

File tree

7 files changed

+36
-40
lines changed

7 files changed

+36
-40
lines changed

src/goto-analyzer/taint_analysis.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ void taint_analysist::instrument(
7575

7676
if(instruction.is_function_call())
7777
{
78-
const code_function_callt &function_call =
79-
instruction.get_function_call();
80-
const exprt &function = function_call.function();
78+
const exprt &function = instruction.call_function();
8179

8280
if(function.id() == ID_symbol)
8381
{
@@ -144,18 +142,18 @@ void taint_analysist::instrument(
144142
{
145143
unsigned nr =
146144
have_this ? rule.parameter_number : rule.parameter_number - 1;
147-
if(function_call.arguments().size() > nr)
148-
where = function_call.arguments()[nr];
145+
if(instruction.call_arguments().size() > nr)
146+
where = instruction.call_arguments()[nr];
149147
break;
150148
}
151149

152150
case taint_parse_treet::rulet::THIS:
153151
if(have_this)
154152
{
155153
DATA_INVARIANT(
156-
!function_call.arguments().empty(),
154+
!instruction.call_arguments().empty(),
157155
"`this` implies at least one argument in function call");
158-
where = function_call.arguments()[0];
156+
where = instruction.call_arguments()[0];
159157
}
160158
break;
161159
}

src/goto-instrument/dot.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ void dott::write_dot_subgraph(
144144
tmp.str("Atomic End");
145145
else if(it->is_function_call())
146146
{
147-
const auto &function_call = it->get_function_call();
147+
const code_function_callt function_call(
148+
it->call_lhs(), it->call_function(), it->call_arguments());
148149
std::string t = from_expr(ns, function_id, function_call);
149150
while(t[ t.size()-1 ]=='\n')
150151
t = t.substr(0, t.size()-1);

src/goto-instrument/goto_program2code.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ goto_programt::const_targett goto_program2codet::convert_instruction(
170170
return target;
171171

172172
case FUNCTION_CALL:
173-
dest.add(target->get_function_call());
173+
{
174+
code_function_callt call(
175+
target->call_lhs(), target->call_function(), target->call_arguments());
176+
dest.add(call);
177+
}
174178
return target;
175179

176180
case OTHER:
@@ -465,8 +469,7 @@ goto_programt::const_targett goto_program2codet::convert_decl(
465469
!next->is_target() &&
466470
(next->is_assign() || next->is_function_call()))
467471
{
468-
exprt lhs =
469-
next->is_assign() ? next->assign_lhs() : next->get_function_call().lhs();
472+
exprt lhs = next->is_assign() ? next->assign_lhs() : next->call_lhs();
470473
if(lhs==symbol &&
471474
va_list_expr.find(lhs)==va_list_expr.end())
472475
{
@@ -477,9 +480,11 @@ goto_programt::const_targett goto_program2codet::convert_decl(
477480
else
478481
{
479482
// could hack this by just erasing the first operand
480-
const code_function_callt &f = next->get_function_call();
481483
side_effect_expr_function_callt call(
482-
f.function(), f.arguments(), typet{}, source_locationt{});
484+
next->call_function(),
485+
next->call_arguments(),
486+
typet{},
487+
source_locationt{});
483488
d.copy_to_operands(call);
484489
}
485490

@@ -1299,15 +1304,16 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
12991304
thread_start->call_arguments().size() == 1 &&
13001305
after_thread_start == thread_end)
13011306
{
1302-
const code_function_callt &cf = thread_start->get_function_call();
1303-
13041307
system_headers.insert("pthread.h");
13051308

13061309
const null_pointer_exprt n(pointer_type(empty_typet()));
13071310
dest.add(code_function_callt(
1308-
cf.lhs(),
1311+
thread_start->call_lhs(),
13091312
symbol_exprt("pthread_create", code_typet({}, empty_typet())),
1310-
{n, n, cf.function(), cf.arguments().front()}));
1313+
{n,
1314+
n,
1315+
thread_start->call_function(),
1316+
thread_start->call_arguments().front()}));
13111317

13121318
return thread_end;
13131319
}

src/goto-programs/goto_program.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,20 +271,6 @@ class goto_programt
271271
return to_code_return(code).return_value();
272272
}
273273

274-
/// Get the function call for FUNCTION_CALL
275-
#if 1
276-
DEPRECATED(SINCE(
277-
2021,
278-
2,
279-
24,
280-
"Use call_function(), call_lhs(), call_arguments() instead"))
281-
const code_function_callt &get_function_call() const
282-
{
283-
PRECONDITION(is_function_call());
284-
return to_code_function_call(code);
285-
}
286-
#endif
287-
288274
/// Get the function that is called for FUNCTION_CALL
289275
const exprt &call_function() const
290276
{

src/goto-programs/remove_virtual_functions.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
289289
}
290290
else
291291
{
292-
auto c = target->get_function_call();
292+
auto c = code_function_callt(
293+
target->call_lhs(), target->call_function(), target->call_arguments());
293294
create_static_function_call(c, *functions.front().symbol_expr, ns);
294295
target->call_function() = c.function();
295296
target->call_arguments() = c.arguments();
@@ -299,7 +300,8 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table(
299300

300301
const auto &vcall_source_loc=target->source_location;
301302

302-
code_function_callt code(target->get_function_call());
303+
code_function_callt code(
304+
target->call_lhs(), target->call_function(), target->call_arguments());
303305
goto_programt new_code_for_this_argument;
304306

305307
process_this_argument(

src/goto-programs/restrict_function_pointers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ void restrict_function_pointer(
7777

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

82-
if(!can_cast_expr<dereference_exprt>(original_function_call.function()))
82+
if(!can_cast_expr<dereference_exprt>(original_function))
8383
return;
8484

8585
// because we run the label function pointer calls transformation pass before
8686
// this stage a dereference can only dereference a symbol expression
8787
auto const &called_function_pointer =
88-
to_dereference_expr(original_function_call.function()).pointer();
88+
to_dereference_expr(original_function).pointer();
8989
PRECONDITION(can_cast_expr<symbol_exprt>(called_function_pointer));
9090
auto const &pointer_symbol = to_symbol_expr(called_function_pointer);
9191
auto const restriction_iterator =

src/goto-symex/symex_main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ void goto_symext::print_symex_step(statet &state)
582582
print_callstack_entry(state.source) << messaget::eom;
583583

584584
// Add the method we're about to enter with no location number.
585-
log.status() << format(state.source.pc->get_function_call().function())
586-
<< messaget::eom << messaget::eom;
585+
log.status() << format(state.source.pc->call_function()) << messaget::eom
586+
<< messaget::eom;
587587
}
588588
}
589589
}
@@ -675,8 +675,11 @@ void goto_symext::execute_next_instruction(
675675
case FUNCTION_CALL:
676676
if(state.reachable)
677677
{
678-
symex_function_call(
679-
get_goto_function, state, instruction.get_function_call());
678+
code_function_callt call(
679+
instruction.call_lhs(),
680+
instruction.call_function(),
681+
instruction.call_arguments());
682+
symex_function_call(get_goto_function, state, call);
680683
}
681684
else
682685
symex_transition(state);

0 commit comments

Comments
 (0)