Skip to content

Commit 1cb7aa3

Browse files
committed
source location when using a contract
1 parent b6f2d08 commit 1cb7aa3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/cprover/instrument_contracts.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ exprt add_function(irep_idt function_identifier, exprt src)
5353
return src;
5454
}
5555

56+
exprt replace_source_location(
57+
exprt src,
58+
const source_locationt &source_location)
59+
{
60+
for(auto &op : src.operands())
61+
op = replace_source_location(op, source_location);
62+
63+
src.add_source_location() = source_location;
64+
65+
return src;
66+
}
67+
5668
static exprt make_assigns_assertion(
5769
irep_idt function_identifier,
5870
const exprt::operandst &assigns,
@@ -367,9 +379,10 @@ void replace_function_calls_by_contracts(
367379

368380
auto replaced_lhs = lhs;
369381
replace_symbol(replaced_lhs);
382+
auto fixed_lhs = replace_source_location(replaced_lhs, location);
370383

371384
dest.add(
372-
goto_programt::make_assignment(replaced_lhs, rhs, location));
385+
goto_programt::make_assignment(fixed_lhs, rhs, location));
373386
}
374387
}
375388

0 commit comments

Comments
 (0)