Skip to content

Commit c9284ae

Browse files
author
Daniel Kroening
authored
Merge pull request #5044 from diffblue/binary_infix_exprt
offer .lhs() and .rhs() for all binary expressions
2 parents 31ce65b + dfb9421 commit c9284ae

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/analyses/goto_check.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,11 @@ void goto_checkt::nan_check(
10651065

10661066
isnan = or_exprt(
10671067
and_exprt(
1068-
equal_exprt(minus_expr.op0(), plus_inf),
1069-
equal_exprt(minus_expr.op1(), plus_inf)),
1068+
equal_exprt(minus_expr.lhs(), plus_inf),
1069+
equal_exprt(minus_expr.rhs(), plus_inf)),
10701070
and_exprt(
1071-
equal_exprt(minus_expr.op0(), minus_inf),
1072-
equal_exprt(minus_expr.op1(), minus_inf)));
1071+
equal_exprt(minus_expr.lhs(), minus_inf),
1072+
equal_exprt(minus_expr.rhs(), minus_inf)));
10731073
}
10741074
else
10751075
UNREACHABLE;

src/solvers/flattening/bv_pointers.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,23 +393,23 @@ bvt bv_pointerst::convert_pointer_type(const exprt &expr)
393393
const minus_exprt &minus_expr = to_minus_expr(expr);
394394

395395
INVARIANT(
396-
minus_expr.op0().type().id() == ID_pointer,
396+
minus_expr.lhs().type().id() == ID_pointer,
397397
"first operand should be of pointer type");
398398

399399
if(
400-
minus_expr.op1().type().id() != ID_unsignedbv &&
401-
minus_expr.op1().type().id() != ID_signedbv)
400+
minus_expr.rhs().type().id() != ID_unsignedbv &&
401+
minus_expr.rhs().type().id() != ID_signedbv)
402402
{
403403
bvt bv;
404404
conversion_failed(minus_expr, bv);
405405
return bv;
406406
}
407407

408-
const unary_minus_exprt neg_op1(minus_expr.op1());
408+
const unary_minus_exprt neg_op1(minus_expr.rhs());
409409

410-
bvt bv = convert_bv(minus_expr.op0());
410+
bvt bv = convert_bv(minus_expr.lhs());
411411

412-
typet pointer_sub_type = minus_expr.op0().type().subtype();
412+
typet pointer_sub_type = minus_expr.rhs().type().subtype();
413413
mp_integer element_size;
414414

415415
if(pointer_sub_type.id()==ID_empty)

src/util/std_expr.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,26 @@ class binary_exprt : public expr_protectedt
691691
check(expr, vm);
692692
}
693693

694+
exprt &lhs()
695+
{
696+
return exprt::op0();
697+
}
698+
699+
const exprt &lhs() const
700+
{
701+
return exprt::op0();
702+
}
703+
704+
exprt &rhs()
705+
{
706+
return exprt::op1();
707+
}
708+
709+
const exprt &rhs() const
710+
{
711+
return exprt::op1();
712+
}
713+
694714
// make op0 and op1 public
695715
using exprt::op0;
696716
using exprt::op1;
@@ -821,26 +841,6 @@ class binary_relation_exprt:public binary_predicate_exprt
821841
expr_binary.op0().type() == expr_binary.op1().type(),
822842
"lhs and rhs of binary relation expression should have same type");
823843
}
824-
825-
exprt &lhs()
826-
{
827-
return op0();
828-
}
829-
830-
const exprt &lhs() const
831-
{
832-
return op0();
833-
}
834-
835-
exprt &rhs()
836-
{
837-
return op1();
838-
}
839-
840-
const exprt &rhs() const
841-
{
842-
return op1();
843-
}
844844
};
845845

846846
template <>

0 commit comments

Comments
 (0)