Skip to content

Commit 04c83d3

Browse files
authored
Merge pull request #3621 from diffblue/symex-type-renaming2
goto_symex: use ranged for
2 parents 1057c61 + 17bcda3 commit 04c83d3

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -419,19 +419,17 @@ bool goto_symex_statet::l2_thread_read_encoding(
419419
read_guard.add(false_exprt());
420420

421421
a_s_r_entryt &a_s_read=read_in_atomic_section[ssa_l1];
422-
for(std::list<guardt>::const_iterator it=a_s_read.second.begin();
423-
it!=a_s_read.second.end();
424-
++it)
422+
for(const auto &a_s_read_guard : a_s_read.second)
425423
{
426-
guardt g=*it;
424+
guardt g = a_s_read_guard; // copy
427425
g-=guard;
428426
if(g.is_true())
429427
// there has already been a read l1_identifier within
430428
// this atomic section under the same guard, or a guard
431429
// that implies the current one
432430
return false;
433431

434-
read_guard|=*it;
432+
read_guard |= a_s_read_guard;
435433
}
436434

437435
exprt cond=read_guard.as_expr();
@@ -672,15 +670,14 @@ void goto_symex_statet::rename(
672670
struct_union_typet &s_u_type=to_struct_union_type(type);
673671
struct_union_typet::componentst &components=s_u_type.components();
674672

675-
for(struct_union_typet::componentst::iterator
676-
it=components.begin();
677-
it!=components.end();
678-
++it)
673+
for(auto &component : components)
674+
{
679675
// be careful, or it might get cyclic
680-
if(it->type().id()==ID_array)
681-
rename(to_array_type(it->type()).size(), ns, level);
682-
else if(it->type().id()!=ID_pointer)
683-
rename(it->type(), irep_idt(), ns, level);
676+
if(component.type().id() == ID_array)
677+
rename(to_array_type(component.type()).size(), ns, level);
678+
else if(component.type().id() != ID_pointer)
679+
rename(component.type(), irep_idt(), ns, level);
680+
}
684681
}
685682
else if(type.id()==ID_pointer)
686683
{
@@ -739,11 +736,8 @@ void goto_symex_statet::get_original_name(typet &type) const
739736
struct_union_typet &s_u_type=to_struct_union_type(type);
740737
struct_union_typet::componentst &components=s_u_type.components();
741738

742-
for(struct_union_typet::componentst::iterator
743-
it=components.begin();
744-
it!=components.end();
745-
++it)
746-
get_original_name(it->type());
739+
for(auto &component : components)
740+
get_original_name(component.type());
747741
}
748742
else if(type.id()==ID_pointer)
749743
{

0 commit comments

Comments
 (0)