Skip to content

Commit b6f2d08

Browse files
committed
make_assigns_assertion now gets function identifier
1 parent d467580 commit b6f2d08

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/cprover/instrument_contracts.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,22 @@ static bool is_symbol_member(const exprt &expr)
4141
return false;
4242
}
4343

44-
static exprt
45-
make_assigns_assertion(const exprt::operandst &assigns, const exprt &lhs)
44+
// add the function to the source location
45+
exprt add_function(irep_idt function_identifier, exprt src)
46+
{
47+
for(auto &op : src.operands())
48+
op = add_function(function_identifier, op);
49+
50+
if(!src.source_location().get_file().empty())
51+
src.add_source_location().set_function(function_identifier);
52+
53+
return src;
54+
}
55+
56+
static exprt make_assigns_assertion(
57+
irep_idt function_identifier,
58+
const exprt::operandst &assigns,
59+
const exprt &lhs)
4660
{
4761
// trivial match?
4862
if(is_symbol_member(lhs))
@@ -72,6 +86,7 @@ make_assigns_assertion(const exprt::operandst &assigns, const exprt &lhs)
7286
}
7387
else
7488
{
89+
// auto fixed_a = add_function(function_identifier, a);
7590
auto target_address = make_address(a);
7691
auto lhs_address = make_address(lhs);
7792
lhs_address =
@@ -150,18 +165,6 @@ exprt replace_old(
150165
}
151166
}
152167

153-
// add the function to the source location
154-
exprt add_function(irep_idt function_identifier, exprt src)
155-
{
156-
for(auto &op : src.operands())
157-
op = add_function(function_identifier, op);
158-
159-
if(!src.source_location().get_file().empty())
160-
src.add_source_location().set_function(function_identifier);
161-
162-
return src;
163-
}
164-
165168
void instrument_contract_checks(
166169
goto_functionst::function_mapt::value_type &f,
167170
const namespacet &ns)
@@ -246,7 +249,7 @@ void instrument_contract_checks(
246249

247250
// maybe not ok
248251
auto assigns_assertion =
249-
make_assigns_assertion(contract.assigns(), lhs);
252+
make_assigns_assertion(f.first, contract.assigns(), lhs);
250253
auto location = it->source_location();
251254
location.set_property_class("assigns");
252255
location.set_comment("assigns clause");

0 commit comments

Comments
 (0)