Skip to content

Commit bd87e57

Browse files
Make function call take renamedt arguments
This reflects the assumption this makes on the expressions passed as arguments.
1 parent 7134344 commit bd87e57

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/goto-symex/symex_function_call.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Author: Daniel Kroening, [email protected]
1717
#include <util/exception_utils.h>
1818
#include <util/invariant.h>
1919
#include <util/prefix.h>
20+
#include <util/range.h>
2021

2122
static void locality(
2223
const irep_idt &function_identifier,
@@ -270,9 +271,10 @@ void goto_symext::symex_function_call_code(
270271
}
271272

272273
// read the arguments -- before the locality renaming
273-
exprt::operandst arguments = call.arguments();
274-
for(auto &a : arguments)
275-
a = state.rename(std::move(a), ns).get();
274+
const exprt::operandst &arguments = call.arguments();
275+
const std::vector<renamedt<exprt, L2>> renamed_arguments =
276+
make_range(arguments).map(
277+
[&](const exprt &a) { return state.rename(a, ns); });
276278

277279
// we hide the call if the caller and callee are both hidden
278280
const bool callee_is_hidden = ns.lookup(identifier).is_hidden();
@@ -281,7 +283,7 @@ void goto_symext::symex_function_call_code(
281283

282284
// record the call
283285
target.function_call(
284-
state.guard.as_expr(), identifier, arguments, state.source, hidden);
286+
state.guard.as_expr(), identifier, renamed_arguments, state.source, hidden);
285287

286288
if(!goto_function.body_available())
287289
{

src/goto-symex/symex_target.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Author: Daniel Kroening, [email protected]
1414

1515
#include <goto-programs/goto_program.h>
1616

17+
#include "renaming_level.h"
18+
1719
class ssa_exprt;
1820
class symbol_exprt;
1921

@@ -155,7 +157,7 @@ class symex_targett
155157
virtual void function_call(
156158
const exprt &guard,
157159
const irep_idt &function_id,
158-
const std::vector<exprt> &ssa_function_arguments,
160+
const std::vector<renamedt<exprt, L2>> &ssa_function_arguments,
159161
const sourcet &source,
160162
bool hidden) = 0;
161163

src/goto-symex/symex_target_equation.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void symex_target_equationt::location(
188188
void symex_target_equationt::function_call(
189189
const exprt &guard,
190190
const irep_idt &function_id,
191-
const std::vector<exprt> &ssa_function_arguments,
191+
const std::vector<renamedt<exprt, L2>> &function_arguments,
192192
const sourcet &source,
193193
const bool hidden)
194194
{
@@ -197,7 +197,8 @@ void symex_target_equationt::function_call(
197197

198198
SSA_step.guard = guard;
199199
SSA_step.called_function = function_id;
200-
SSA_step.ssa_function_arguments = ssa_function_arguments;
200+
for(const auto &arg : function_arguments)
201+
SSA_step.ssa_function_arguments.emplace_back(arg.get());
201202
SSA_step.hidden = hidden;
202203

203204
merge_ireps(SSA_step);

src/goto-symex/symex_target_equation.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Author: Daniel Kroening, [email protected]
2626

2727
#include <solvers/prop/literal.h>
2828

29+
#include "renaming_level.h"
2930
#include "ssa_step.h"
3031
#include "symex_target.h"
3132

@@ -87,7 +88,7 @@ class symex_target_equationt:public symex_targett
8788
virtual void function_call(
8889
const exprt &guard,
8990
const irep_idt &function_id,
90-
const std::vector<exprt> &ssa_function_arguments,
91+
const std::vector<renamedt<exprt, L2>> &ssa_function_arguments,
9192
const sourcet &source,
9293
bool hidden);
9394

0 commit comments

Comments
 (0)