File tree 2 files changed +15
-1
lines changed 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)
292
292
293
293
exprt make_and (exprt a, exprt b)
294
294
{
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
+ }
295
308
if (b.id () == ID_and)
296
309
{
297
310
b.add_to_operands (std::move (a));
Original file line number Diff line number Diff line change @@ -101,7 +101,8 @@ class is_constantt
101
101
constant_exprt make_boolean_expr (bool );
102
102
103
103
// / 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`.
105
106
exprt make_and (exprt a, exprt b);
106
107
107
108
#endif // CPROVER_UTIL_EXPR_UTIL_H
You can’t perform that action at this time.
0 commit comments