Skip to content

Commit 33f1572

Browse files
committed
Use operator==(exprt, int) instead of is_one
Avoids use the newly deprecated exprt method.
1 parent 706c1ee commit 33f1572

File tree

8 files changed

+20
-17
lines changed

8 files changed

+20
-17
lines changed

src/analyses/variable-sensitivity/interval_abstract_value.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,10 @@ bool new_interval_is_top(const constant_interval_exprt &e)
242242
if(e.get_lower() == false && e.get_upper() == true)
243243
return true;
244244
if(
245-
e.type().id() == ID_c_bool && e.get_lower().is_zero() &&
246-
e.get_upper().is_one())
245+
e.type().id() == ID_c_bool && e.get_lower().is_zero() && e.get_upper() == 1)
246+
{
247247
return true;
248+
}
248249

249250
return false;
250251
}

src/analyses/variable-sensitivity/value_set_abstract_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static bool is_set_extreme(const typet &type, const abstract_object_sett &set)
459459
},
460460
[](const abstract_value_objectt &value) {
461461
auto c = value.to_constant();
462-
return c.is_one() || (c.id() == ID_max_value);
462+
return c == 1 || (c.id() == ID_max_value);
463463
});
464464
}
465465

src/ansi-c/goto-conversion/builtin_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static exprt make_va_list(const exprt &expr, const namespacet &ns)
618618
}
619619

620620
while(result.type().id() == ID_array &&
621-
to_array_type(result.type()).size().is_one())
621+
to_array_type(result.type()).size() == 1)
622622
{
623623
result = index_exprt{result, from_integer(0, c_index_type())};
624624
}

src/ansi-c/parser.y

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,8 +1606,10 @@ pragma_packed:
16061606
{
16071607
init($$);
16081608
if(!PARSER.pragma_pack.empty() &&
1609-
PARSER.pragma_pack.back().is_one())
1609+
PARSER.pragma_pack.back() == 1)
1610+
{
16101611
set($$, ID_packed);
1612+
}
16111613
}
16121614
;
16131615

src/util/interval.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ exprt constant_interval_exprt::generate_division_expression(
689689

690690
PRECONDITION(!is_zero(rhs));
691691

692-
if(rhs.is_one())
692+
if(rhs == 1)
693693
{
694694
return lhs;
695695
}
@@ -744,7 +744,7 @@ exprt constant_interval_exprt::generate_modulo_expression(
744744

745745
PRECONDITION(!is_zero(rhs));
746746

747-
if(rhs.is_one())
747+
if(rhs == 1)
748748
{
749749
return lhs;
750750
}

src/util/simplify_expr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ simplify_exprt::simplify_overflow_binary(const binary_overflow_exprt &expr)
25562556
// One is neutral element for multiplication
25572557
if(
25582558
can_cast_expr<mult_overflow_exprt>(expr) &&
2559-
(expr.op0().is_one() || expr.op1().is_one()))
2559+
(expr.op0() == 1 || expr.op1() == 1))
25602560
{
25612561
return false_exprt{};
25622562
}
@@ -2751,10 +2751,10 @@ simplify_exprt::simplify_overflow_result(const overflow_result_exprt &expr)
27512751
// One is neutral element for multiplication
27522752
if(
27532753
expr.id() == ID_overflow_result_mult &&
2754-
(expr.op0().is_one() || expr.op1().is_one()))
2754+
(expr.op0() == 1 || expr.op1() == 1))
27552755
{
27562756
return struct_exprt{
2757-
{expr.op0().is_one() ? expr.op1() : expr.op0(), false_exprt{}},
2757+
{expr.op0() == 1 ? expr.op1() : expr.op0(), false_exprt{}},
27582758
expr.type()};
27592759
}
27602760

src/util/simplify_expr_floatbv.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,9 @@ simplify_exprt::simplify_floatbv_op(const ieee_float_op_exprt &expr)
347347
}
348348

349349
// division by one? Exact for all rounding modes.
350-
if(expr.id()==ID_floatbv_div &&
351-
op1.is_constant() && op1.is_one())
350+
if(
351+
expr.id() == ID_floatbv_div && op1.is_constant() &&
352+
ieee_float_valuet{to_constant_expr(op1)} == 1)
352353
{
353354
return op0;
354355
}

src/util/simplify_expr_int.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ simplify_exprt::resultt<> simplify_exprt::simplify_mult(const mult_exprt &expr)
253253
else
254254
{
255255
// if the constant is a one and there are other factors
256-
if(constant_found && constant->is_one())
256+
if(constant_found && *constant == 1)
257257
{
258258
// just delete it
259259
new_operands.erase(constant);
@@ -346,8 +346,7 @@ simplify_exprt::resultt<> simplify_exprt::simplify_div(const div_exprt &expr)
346346
else if(expr_type.id()==ID_fixedbv)
347347
{
348348
// division by one?
349-
if(expr.op1().is_constant() &&
350-
expr.op1().is_one())
349+
if(expr.op1().is_constant() && expr.op1() == 1)
351350
{
352351
return expr.op0();
353352
}
@@ -678,7 +677,7 @@ simplify_exprt::simplify_bitwise(const multi_ary_exprt &expr)
678677
if(op.id() == ID_typecast && to_typecast_expr(op).op().is_boolean())
679678
{
680679
}
681-
else if(op.is_zero() || op.is_one())
680+
else if(op.is_zero() || op == 1)
682681
{
683682
}
684683
else
@@ -707,7 +706,7 @@ simplify_exprt::simplify_bitwise(const multi_ary_exprt &expr)
707706
*it = to_typecast_expr(*it).op();
708707
else if(it->is_zero())
709708
*it=false_exprt();
710-
else if(it->is_one())
709+
else if(*it == 1)
711710
*it=true_exprt();
712711
}
713712

0 commit comments

Comments
 (0)