Skip to content

Commit 0dbab2a

Browse files
committed
minor improvements to assigns clause checking
1 parent a9a6986 commit 0dbab2a

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/goto-instrument/contracts/contracts.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ void code_contractst::check_apply_loop_contracts(
178178
}
179179
else
180180
{
181-
for(const auto &target : assigns.operands())
182-
modifies.insert(target);
181+
modifies.insert(assigns.operands().cbegin(), assigns.operands().cend());
183182

184183
// Create snapshots of write set CARs.
185184
// This must be done before havocing the write set.
@@ -264,11 +263,10 @@ void code_contractst::check_apply_loop_contracts(
264263
// Copy the loop_head as we would increment the iterator while instrumenting.
265264
if(assigns.is_not_nil())
266265
{
267-
auto copy_loop_head = loop_head;
268266
check_frame_conditions(
269267
function_name,
270268
goto_function.body,
271-
copy_loop_head,
269+
loop_head,
272270
loop_end,
273271
loop_assigns);
274272
}
@@ -649,8 +647,7 @@ bool code_contractst::apply_function_contract(
649647

650648
// Havoc all targets in the write set
651649
modifiest modifies;
652-
for(const auto &target : targets.operands())
653-
modifies.insert(target);
650+
modifies.insert(targets.operands().cbegin(), targets.operands().cend());
654651

655652
goto_programt assigns_havoc;
656653
havoc_assigns_targetst havoc_gen(modifies, ns);
@@ -1000,7 +997,7 @@ bool code_contractst::check_frame_conditions_function(const irep_idt &function)
1000997
void code_contractst::check_frame_conditions(
1001998
const irep_idt &function,
1002999
goto_programt &body,
1003-
goto_programt::targett &instruction_it,
1000+
goto_programt::targett instruction_it,
10041001
const goto_programt::targett &instruction_end,
10051002
assigns_clauset &assigns)
10061003
{

src/goto-instrument/contracts/contracts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class code_contractst
131131
void check_frame_conditions(
132132
const irep_idt &,
133133
goto_programt &,
134-
goto_programt::targett &,
134+
goto_programt::targett,
135135
const goto_programt::targett &,
136136
assigns_clauset &);
137137

0 commit comments

Comments
 (0)