Skip to content

Commit 3d8e181

Browse files
authored
Merge pull request #5783 from tautschnig/forall-subtypes
Remove {f,F}orall_subtypes
2 parents 4c2c4f6 + 22a59fb commit 3d8e181

14 files changed

+49
-54
lines changed

.clang-format

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ ForEachMacros: [
3838
'Forall_operands',
3939
'forall_expr',
4040
'Forall_expr',
41-
'forall_symbol_base_map',
42-
'forall_subtypes',
43-
'Forall_subtypes']
41+
'forall_symbol_base_map']
4442
IndentCaseLabels: 'false'
4543
IndentPPDirectives: AfterHash
4644
IndentWidth: '2'

src/ansi-c/ansi_c_convert_type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
3232
{
3333
if(type.id()==ID_merged_type)
3434
{
35-
forall_subtypes(it, type)
36-
read_rec(*it);
35+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
36+
read_rec(subtype);
3737
}
3838
else if(type.id()==ID_signed)
3939
signed_cnt++;

src/ansi-c/ansi_c_parser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,11 @@ ansi_c_id_classt ansi_c_parsert::get_class(const typet &type)
164164
return ansi_c_id_classt::ANSI_C_TAG;
165165
else if(type.id()==ID_merged_type)
166166
{
167-
forall_subtypes(it, type)
168-
if(get_class(*it)==ansi_c_id_classt::ANSI_C_TYPEDEF)
167+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
168+
{
169+
if(get_class(subtype) == ansi_c_id_classt::ANSI_C_TYPEDEF)
169170
return ansi_c_id_classt::ANSI_C_TYPEDEF;
171+
}
170172
}
171173
else if(type.has_subtype())
172174
return get_class(type.subtype());

src/ansi-c/c_storage_spec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void c_storage_spect::read(const typet &type)
1616
if(type.id()==ID_merged_type ||
1717
type.id()==ID_code)
1818
{
19-
forall_subtypes(it, type)
20-
read(*it);
19+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
20+
read(subtype);
2121
}
2222
else if(type.id()==ID_static)
2323
is_static=true;

src/ansi-c/type2name.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ static std::string type2name(
258258
if(type.has_subtypes())
259259
{
260260
result+='$';
261-
forall_subtypes(it, type)
261+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
262262
{
263-
result+=type2name(*it, ns, symbol_number);
263+
result += type2name(subtype, ns, symbol_number);
264264
result+='|';
265265
}
266266
result[result.size()-1]='$';

src/cpp/cpp_declaration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void cpp_declarationt::name_anon_struct_union(typet &dest)
5757
}
5858
else if(dest.id()==ID_merged_type)
5959
{
60-
Forall_subtypes(it, dest)
61-
name_anon_struct_union(*it);
60+
for(typet &subtype : to_type_with_subtypes(dest).subtypes())
61+
name_anon_struct_union(subtype);
6262
}
6363
}

src/cpp/cpp_storage_spec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ void cpp_storage_spect::read(const typet &type)
1212
{
1313
if(type.id() == ID_merged_type || type.id() == ID_function_type)
1414
{
15-
forall_subtypes(it, type)
16-
read(*it);
15+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
16+
read(subtype);
1717
}
1818
else if(type.id() == ID_static)
1919
set_static();

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ bool cpp_typecheckt::has_const(const typet &type)
3535
return true;
3636
else if(type.id()==ID_merged_type)
3737
{
38-
forall_subtypes(it, type)
39-
if(has_const(*it))
38+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
39+
{
40+
if(has_const(subtype))
4041
return true;
42+
}
4143

4244
return false;
4345
}
@@ -51,9 +53,11 @@ bool cpp_typecheckt::has_volatile(const typet &type)
5153
return true;
5254
else if(type.id()==ID_merged_type)
5355
{
54-
forall_subtypes(it, type)
55-
if(has_volatile(*it))
56+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
57+
{
58+
if(has_volatile(subtype))
5659
return true;
60+
}
5761

5862
return false;
5963
}
@@ -69,9 +73,11 @@ bool cpp_typecheckt::has_auto(const typet &type)
6973
type.id() == ID_merged_type || type.id() == ID_frontend_pointer ||
7074
type.id() == ID_pointer)
7175
{
72-
forall_subtypes(it, type)
73-
if(has_auto(*it))
76+
for(const typet &subtype : to_type_with_subtypes(type).subtypes())
77+
{
78+
if(has_auto(subtype))
7479
return true;
80+
}
7581

7682
return false;
7783
}

src/cpp/template_map.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void template_mapt::apply(typet &type) const
6262
}
6363
else if(type.id()==ID_merged_type)
6464
{
65-
Forall_subtypes(it, type)
66-
apply(*it);
65+
for(typet &subtype : to_type_with_subtypes(type).subtypes())
66+
apply(subtype);
6767
}
6868
}
6969

src/goto-instrument/dump_c.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,8 @@ void dump_ct::cleanup_expr(exprt &expr)
14751475

14761476
void dump_ct::cleanup_type(typet &type)
14771477
{
1478-
Forall_subtypes(it, type)
1479-
cleanup_type(*it);
1478+
for(typet &subtype : to_type_with_subtypes(type).subtypes())
1479+
cleanup_type(subtype);
14801480

14811481
if(type.id()==ID_code)
14821482
{

0 commit comments

Comments
 (0)