File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,19 @@ constant_exprt make_boolean_expr(bool value)
292292
293293exprt make_and (exprt a, exprt b)
294294{
295+ PRECONDITION (a.type ().id () == ID_bool && b.type ().id () == ID_bool);
296+ if (b.is_constant ())
297+ {
298+ if (b.get (ID_value) == ID_false)
299+ return false_exprt{};
300+ return a;
301+ }
302+ if (a.is_constant ())
303+ {
304+ if (a.get (ID_value) == ID_false)
305+ return false_exprt{};
306+ return b;
307+ }
295308 if (b.id () == ID_and)
296309 {
297310 b.add_to_operands (std::move (a));
Original file line number Diff line number Diff line change @@ -101,7 +101,8 @@ class is_constantt
101101constant_exprt make_boolean_expr (bool );
102102
103103// / Conjunction of two expressions. If the second is already an `and_exprt`
104- // / add to its operands instead of creating a new expression.
104+ // / add to its operands instead of creating a new expression. If one is `true`,
105+ // / return the other expression. If one is `false` returns `false`.
105106exprt make_and (exprt a, exprt b);
106107
107108#endif // CPROVER_UTIL_EXPR_UTIL_H
You can’t perform that action at this time.
0 commit comments