diff --git a/src/goto-analyzer/taint_analysis.cpp b/src/goto-analyzer/taint_analysis.cpp index bbecb983319..11c09a623ab 100644 --- a/src/goto-analyzer/taint_analysis.cpp +++ b/src/goto-analyzer/taint_analysis.cpp @@ -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) { @@ -144,8 +142,8 @@ 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; } @@ -153,9 +151,9 @@ void taint_analysist::instrument( 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; } diff --git a/src/goto-instrument/dot.cpp b/src/goto-instrument/dot.cpp index 3c032658e34..7bc90b155d1 100644 --- a/src/goto-instrument/dot.cpp +++ b/src/goto-instrument/dot.cpp @@ -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); diff --git a/src/goto-instrument/goto_program2code.cpp b/src/goto-instrument/goto_program2code.cpp index da2e54a8048..ed548ddef59 100644 --- a/src/goto-instrument/goto_program2code.cpp +++ b/src/goto-instrument/goto_program2code.cpp @@ -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: @@ -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()) { @@ -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); } @@ -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; } diff --git a/src/goto-programs/goto_program.h b/src/goto-programs/goto_program.h index b35398485fb..bbb3d8ee823 100644 --- a/src/goto-programs/goto_program.h +++ b/src/goto-programs/goto_program.h @@ -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 { diff --git a/src/goto-programs/remove_virtual_functions.cpp b/src/goto-programs/remove_virtual_functions.cpp index 41ea0e88307..a241e81cf16 100644 --- a/src/goto-programs/remove_virtual_functions.cpp +++ b/src/goto-programs/remove_virtual_functions.cpp @@ -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(); @@ -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( diff --git a/src/goto-programs/restrict_function_pointers.cpp b/src/goto-programs/restrict_function_pointers.cpp index 40b1cbafe17..5e6e634bbce 100644 --- a/src/goto-programs/restrict_function_pointers.cpp +++ b/src/goto-programs/restrict_function_pointers.cpp @@ -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(original_function_call.function())) + if(!can_cast_expr(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(called_function_pointer)); auto const &pointer_symbol = to_symbol_expr(called_function_pointer); auto const restriction_iterator = diff --git a/src/goto-symex/symex_main.cpp b/src/goto-symex/symex_main.cpp index 7a4bfad9e1f..0c2d6be518f 100644 --- a/src/goto-symex/symex_main.cpp +++ b/src/goto-symex/symex_main.cpp @@ -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; } } } @@ -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);