Skip to content

Commit 0ee3501

Browse files
committed
minor improvements to assigns clause checking
1 parent 2efe5b2 commit 0ee3501

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/goto-instrument/contracts/contracts.cpp

Lines changed: 4 additions & 11 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,13 +263,8 @@ 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(
269-
function_name,
270-
goto_function.body,
271-
copy_loop_head,
272-
loop_end,
273-
loop_assigns);
267+
function_name, goto_function.body, loop_head, loop_end, loop_assigns);
274268
}
275269

276270
// Generate: assignments to store the multidimensional decreases clause's
@@ -649,8 +643,7 @@ bool code_contractst::apply_function_contract(
649643

650644
// Havoc all targets in the write set
651645
modifiest modifies;
652-
for(const auto &target : targets.operands())
653-
modifies.insert(target);
646+
modifies.insert(targets.operands().cbegin(), targets.operands().cend());
654647

655648
goto_programt assigns_havoc;
656649
havoc_assigns_targetst havoc_gen(modifies, ns);
@@ -1000,7 +993,7 @@ bool code_contractst::check_frame_conditions_function(const irep_idt &function)
1000993
void code_contractst::check_frame_conditions(
1001994
const irep_idt &function,
1002995
goto_programt &body,
1003-
goto_programt::targett &instruction_it,
996+
goto_programt::targett instruction_it,
1004997
const goto_programt::targett &instruction_end,
1005998
assigns_clauset &assigns)
1006999
{

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)