Skip to content

Commit 740976b

Browse files
committed
Refactor if chain to make cases explicit
Makes the code easier to read because it puts the values which we care about into the code rather than the comment. As a bonus an UNREACHABLE invariant will be violated if `expr.id()` value which we haven't accounted for is encountered.
1 parent 6d07357 commit 740976b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/goto-programs/goto_clean_expr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ void goto_convertt::rewrite_boolean(exprt &expr)
144144
{
145145
if_exprt if_e(op, tmp, false_exprt());
146146
tmp.swap(if_e);
147+
continue;
147148
}
148-
else // ID_or
149+
if(expr.id() == ID_or)
149150
{
150151
if_exprt if_e(op, true_exprt(), tmp);
151152
tmp.swap(if_e);
153+
continue;
152154
}
155+
UNREACHABLE;
153156
}
154157

155158
expr.swap(tmp);

0 commit comments

Comments
 (0)