Skip to content

Commit eb148eb

Browse files
authored
Merge pull request #5787 from tautschnig/forall-literals
Remove {f,F}orall_literals
2 parents 26b655b + 692553f commit eb148eb

21 files changed

+98
-87
lines changed

.clang-format

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ ForEachMacros: [
3434
'Forall_goto_functions',
3535
'forall_goto_program_instructions',
3636
'Forall_goto_program_instructions',
37-
'forall_literals',
38-
'Forall_literals',
3937
'forall_operands',
4038
'Forall_operands',
4139
'forall_expr',

src/solvers/flattening/boolbv.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ boolbvt::convert_bv(const exprt &expr, optionalt<std::size_t> expected_width)
142142
cache_result.first->second = bv;
143143

144144
// check
145-
forall_literals(it, cache_result.first->second)
145+
for(const auto &literal : cache_result.first->second)
146146
{
147-
if(freeze_all && !it->is_constant())
148-
prop.set_frozen(*it);
147+
if(freeze_all && !literal.is_constant())
148+
prop.set_frozen(literal);
149149

150150
INVARIANT_WITH_DIAGNOSTICS(
151-
it->var_no() != literalt::unused_var_no(),
151+
literal.var_no() != literalt::unused_var_no(),
152152
"variable number must be different from the unused variable number",
153153
expr.find_source_location(),
154154
irep_pretty_diagnosticst(expr));

src/solvers/flattening/boolbv_array.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ bvt boolbvt::convert_array(const exprt &expr)
3636
{
3737
const bvt &tmp = convert_bv(*it, op_width);
3838

39-
forall_literals(it2, tmp)
40-
bv.push_back(*it2);
39+
bv.insert(bv.end(), tmp.begin(), tmp.end());
4140
}
4241

4342
return bv;

src/solvers/flattening/boolbv_case.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ bvt boolbvt::convert_case(const exprt &expr)
2525
bv.resize(width);
2626

2727
// make it free variables
28-
Forall_literals(it, bv)
29-
*it=prop.new_variable();
28+
for(auto &literal : bv)
29+
literal = prop.new_variable();
3030

3131
DATA_INVARIANT(
3232
operands.size() >= 3, "case should have at least three operands");

src/solvers/flattening/boolbv_complex.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ bvt boolbvt::convert_complex(const complex_exprt &expr)
3131
{
3232
const bvt &tmp = convert_bv(*it, op_width);
3333

34-
forall_literals(it2, tmp)
35-
bv.push_back(*it2);
34+
bv.insert(bv.end(), tmp.begin(), tmp.end());
3635
}
3736

3837
return bv;

src/solvers/flattening/boolbv_cond.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ bvt boolbvt::convert_cond(const cond_exprt &expr)
3434
literalt cond_literal=const_literal(false);
3535

3636
// make it free variables
37-
Forall_literals(it, bv)
38-
*it=prop.new_variable();
37+
for(auto &literal : bv)
38+
literal = prop.new_variable();
3939

4040
forall_operands(it, expr)
4141
{

src/solvers/flattening/boolbv_map.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void boolbv_mapt::get_literals(
9393
map_entry.literal_map.size() == width,
9494
"number of literals in the literal map shall equal the bitvector width");
9595

96-
Forall_literals(it, literals)
96+
for(auto it = literals.begin(); it != literals.end(); ++it)
9797
{
9898
literalt &l=*it;
9999
const std::size_t bit=it-literals.begin();
@@ -127,7 +127,7 @@ void boolbv_mapt::set_literals(
127127
{
128128
map_entryt &map_entry=get_map_entry(identifier, type);
129129

130-
forall_literals(it, literals)
130+
for(auto it = literals.begin(); it != literals.end(); ++it)
131131
{
132132
const literalt &literal=*it;
133133

src/solvers/flattening/boolbv_typecast.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ bool boolbvt::type_conversion(
6464
{
6565
if(src_type==dest_type.subtype())
6666
{
67-
forall_literals(it, src)
68-
dest.push_back(*it);
67+
dest.insert(dest.end(), src.begin(), src.end());
6968

7069
// pad with zeros
7170
for(std::size_t i=src.size(); i<dest_width; i++)
@@ -208,8 +207,8 @@ bool boolbvt::type_conversion(
208207
INVARIANT(
209208
src_width == 1, "bitvector of type boolean shall have width one");
210209

211-
Forall_literals(it, dest)
212-
*it=prop.land(*it, src[0]);
210+
for(auto &literal : dest)
211+
literal = prop.land(literal, src[0]);
213212

214213
return false;
215214
}

src/solvers/flattening/boolbv_vector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ bvt boolbvt::convert_vector(const vector_exprt &expr)
2929
{
3030
const bvt &tmp = convert_bv(*it, op_width);
3131

32-
forall_literals(it2, tmp)
33-
bv.push_back(*it2);
32+
bv.insert(bv.end(), tmp.begin(), tmp.end());
3433
}
3534
}
3635

src/solvers/flattening/bv_pointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ bvt bv_pointerst::convert_pointer_type(const exprt &expr)
243243
bvt bv;
244244
bv.resize(bits);
245245

246-
Forall_literals(it, bv)
247-
*it=prop.new_variable();
246+
for(auto &literal : bv)
247+
literal = prop.new_variable();
248248

249249
return bv;
250250
}

0 commit comments

Comments
 (0)