Skip to content

Commit a895b40

Browse files
committed
Set the flag 'no_enum_check' in an exception safe way
1 parent 9938747 commit a895b40

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/analyses/goto_check.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,13 +1917,13 @@ void goto_checkt::goto_check(
19171917
{
19181918
const code_assignt &code_assign=to_code_assign(i.code);
19191919

1920-
// Question: I am not sure whether adding it as a class field is
1921-
// better than adding it as a function argument. Adding it as an
1922-
// argument means that it needs to be passed as a third argument
1923-
// to many check_rec functions that don't really need it.
1924-
no_enum_check = true;
1925-
check(code_assign.lhs());
1926-
no_enum_check = false;
1920+
// Reset the no_enum_check with the flag reset for exception
1921+
// safety
1922+
{
1923+
flag_resett no_enum_check_flag_resetter;
1924+
no_enum_check_flag_resetter.set_flag(no_enum_check, true);
1925+
check(code_assign.lhs());
1926+
}
19271927
check(code_assign.rhs());
19281928

19291929
// the LHS might invalidate any assertion

0 commit comments

Comments
 (0)