Skip to content

Commit 26f7b71

Browse files
committed
Refactor invalidate
Using the initializer-list constructor for sets and and standard idiom for erase_if.
1 parent 83c10bc commit 26f7b71

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/analyses/goto_check.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,14 @@ void goto_checkt::invalidate(const exprt &lhs)
276276
else if(lhs.id()==ID_symbol)
277277
{
278278
// clear all assertions about 'symbol'
279-
find_symbols_sett find_symbols_set;
280-
find_symbols_set.insert(to_symbol_expr(lhs).get_identifier());
279+
find_symbols_sett find_symbols_set{to_symbol_expr(lhs).get_identifier()};
281280

282-
for(assertionst::iterator
283-
it=assertions.begin();
284-
it!=assertions.end();
285-
) // no it++
281+
for(auto it = assertions.begin(); it != assertions.end();)
286282
{
287-
assertionst::iterator next=it;
288-
next++;
289-
290283
if(has_symbol(*it, find_symbols_set) || has_subexpr(*it, ID_dereference))
291-
assertions.erase(it);
292-
293-
it=next;
284+
it = assertions.erase(it);
285+
else
286+
++it;
294287
}
295288
}
296289
else

0 commit comments

Comments
 (0)