Skip to content

Commit cb9dbc4

Browse files
author
Daniel Kroening
committed
improved typing in simplify_boolean
This improves type safety.
1 parent bcd1af1 commit cb9dbc4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/util/simplify_expr_boolean.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
2727

2828
if(expr.id()==ID_implies)
2929
{
30+
const auto &implies_expr = to_implies_expr(expr);
31+
3032
if(
31-
expr.operands().size() != 2 ||
32-
expr.operands().front().type().id() != ID_bool ||
33-
expr.operands().back().type().id() != ID_bool)
33+
implies_expr.op0().type().id() != ID_bool ||
34+
implies_expr.op1().type().id() != ID_bool)
3435
{
3536
return unchanged(expr);
3637
}
3738

3839
// turn a => b into !a || b
3940

40-
auto new_expr = expr;
41+
binary_exprt new_expr = implies_expr;
4142
new_expr.id(ID_or);
4243
new_expr.op0() = boolean_negate(new_expr.op0());
4344
simplify_node(new_expr);

0 commit comments

Comments
 (0)