Skip to content

Commit 98ed937

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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+101
-110
lines changed

jbmc/src/java_bytecode/expr2java.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ std::string expr2javat::convert_constant(
172172
{
173173
if(src.type().id()==ID_c_bool)
174174
{
175-
if(!src.is_zero())
175+
if(src != 0)
176176
return "true";
177177
else
178178
return "false";
@@ -187,7 +187,7 @@ std::string expr2javat::convert_constant(
187187
else if(src.type().id()==ID_pointer)
188188
{
189189
// Java writes 'null' for the null reference
190-
if(src.is_zero())
190+
if(src == 0)
191191
return "null";
192192
}
193193
else if(src.type()==java_char_type())

src/analyses/local_bitvector_analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ local_bitvector_analysist::flagst local_bitvector_analysist::get_rec(
115115
{
116116
if(rhs.is_constant())
117117
{
118-
if(rhs.is_zero())
118+
if(rhs == 0)
119119
return flagst::mk_null();
120120
else
121121
return flagst::mk_integer_address();

src/analyses/local_may_alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void local_may_aliast::get_rec(
171171
{
172172
if(rhs.is_constant())
173173
{
174-
if(rhs.is_zero())
174+
if(rhs == 0)
175175
dest.insert(objects.number(exprt(ID_null_object)));
176176
else
177177
dest.insert(objects.number(exprt(ID_integer_address_object)));

src/analyses/variable-sensitivity/interval_abstract_value.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ bool new_interval_is_top(const constant_interval_exprt &e)
241241

242242
if(e.get_lower() == false && e.get_upper() == true)
243243
return true;
244-
if(
245-
e.type().id() == ID_c_bool && e.get_lower().is_zero() && e.get_upper() == 1)
244+
if(e.type().id() == ID_c_bool && e.get_lower() == 0 && e.get_upper() == 1)
246245
{
247246
return true;
248247
}

src/analyses/variable-sensitivity/value_set_abstract_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static bool is_set_extreme(const typet &type, const abstract_object_sett &set)
455455
set,
456456
[](const abstract_value_objectt &value) {
457457
auto c = value.to_constant();
458-
return c.is_zero() || (c.id() == ID_min_value);
458+
return c == 0 || (c.id() == ID_min_value);
459459
},
460460
[](const abstract_value_objectt &value) {
461461
auto c = value.to_constant();

src/ansi-c/c_typecast.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,10 @@ void c_typecastt::implicit_typecast_followed(
565565
{
566566
// special case: 0 == NULL
567567

568-
if(simplify_expr(expr, ns).is_zero() && (
569-
src_type.id()==ID_unsignedbv ||
570-
src_type.id()==ID_signedbv ||
571-
src_type.id()==ID_natural ||
572-
src_type.id()==ID_integer))
568+
if(
569+
simplify_expr(expr, ns) == 0 &&
570+
(src_type.id() == ID_unsignedbv || src_type.id() == ID_signedbv ||
571+
src_type.id() == ID_natural || src_type.id() == ID_integer))
573572
{
574573
expr = null_pointer_exprt{to_pointer_type(orig_dest_type)};
575574
return; // ok

src/ansi-c/c_typecheck_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static bool is_instantiation_of_flexible_array(
312312
return old_array_type.element_type() == new_array_type.element_type() &&
313313
old_array_type.get_bool(ID_C_flexible_array_member) &&
314314
new_array_type.get_bool(ID_C_flexible_array_member) &&
315-
(old_array_type.size().is_nil() || old_array_type.size().is_zero());
315+
(old_array_type.size().is_nil() || old_array_type.size() == 0);
316316
}
317317

318318
void c_typecheck_baset::typecheck_redefinition_non_type(

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,15 +1457,13 @@ void c_typecheck_baset::typecheck_expr_rel(
14571457
else
14581458
{
14591459
// pointer and zero
1460-
if(type0.id()==ID_pointer &&
1461-
simplify_expr(op1, *this).is_zero())
1460+
if(type0.id() == ID_pointer && simplify_expr(op1, *this) == 0)
14621461
{
14631462
op1 = null_pointer_exprt{to_pointer_type(type0)};
14641463
return;
14651464
}
14661465

1467-
if(type1.id()==ID_pointer &&
1468-
simplify_expr(op0, *this).is_zero())
1466+
if(type1.id() == ID_pointer && simplify_expr(op0, *this) == 0)
14691467
{
14701468
op0 = null_pointer_exprt{to_pointer_type(type1)};
14711469
return;

src/ansi-c/c_typecheck_initializer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ exprt::operandst::const_iterator c_typecheck_baset::do_designated_initializer(
405405
if(index>=dest->operands().size())
406406
{
407407
if(
408-
type.id() == ID_array && (to_array_type(type).size().is_zero() ||
408+
type.id() == ID_array && (to_array_type(type).size() == 0 ||
409409
to_array_type(type).size().is_nil()))
410410
{
411411
const typet &element_type = to_array_type(type).element_type();
@@ -673,10 +673,10 @@ exprt::operandst::const_iterator c_typecheck_baset::do_designated_initializer(
673673

674674
// in case of a variable-length array consume all remaining
675675
// initializer elements
676-
if(vla_permitted &&
677-
dest_type.id()==ID_array &&
678-
(to_array_type(dest_type).size().is_zero() ||
679-
to_array_type(dest_type).size().is_nil()))
676+
if(
677+
vla_permitted && dest_type.id() == ID_array &&
678+
(to_array_type(dest_type).size() == 0 ||
679+
to_array_type(dest_type).size().is_nil()))
680680
{
681681
value.id(ID_initializer_list);
682682
value.operands().clear();

src/ansi-c/expr2c.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ std::string expr2ct::convert_complex(
12801280
unsigned precedence)
12811281
{
12821282
if(
1283-
src.operands().size() == 2 && to_binary_expr(src).op0().is_zero() &&
1283+
src.operands().size() == 2 && to_binary_expr(src).op0() == 0 &&
12841284
to_binary_expr(src).op1().is_constant())
12851285
{
12861286
// This is believed to be gcc only; check if this is sensible
@@ -3779,7 +3779,7 @@ std::string expr2ct::convert_with_precedence(
37793779

37803780
if(object.id() == ID_label)
37813781
return "&&" + object.get_string(ID_identifier);
3782-
else if(object.id() == ID_index && to_index_expr(object).index().is_zero())
3782+
else if(object.id() == ID_index && to_index_expr(object).index() == 0)
37833783
return convert(to_index_expr(object).array());
37843784
else if(to_pointer_type(src.type()).base_type().id() == ID_code)
37853785
return convert_unary(to_unary_expr(src), "", precedence = 15);

0 commit comments

Comments
 (0)