From e756bb447a8d74c66aba0d1981bfed65732a2c2a Mon Sep 17 00:00:00 2001 From: Romain Beguet Date: Mon, 20 Nov 2023 14:24:10 +0100 Subject: [PATCH] silent_exception_handlers: Fix handling of case statements. --- lkql_checker/share/lkql/control_flow.lkql | 2 +- testsuite/tests/checks/silent_exception_handlers/exc.adb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lkql_checker/share/lkql/control_flow.lkql b/lkql_checker/share/lkql/control_flow.lkql index 828c020a6..98d87568a 100644 --- a/lkql_checker/share/lkql/control_flow.lkql +++ b/lkql_checker/share/lkql/control_flow.lkql @@ -31,7 +31,7 @@ fun all_branches(stmt) = & [alt.f_stmts for alt in stmt.f_alternatives.children].to_list & [stmt.f_else_stmts] | CaseStmt => - [alt.f_stmts for alt in stmt.f_alternatives] + [alt.f_stmts for alt in stmt.f_alternatives.children] | BaseLoopStmt => # We cannot know for sure that control will go inside the loop, so # return "null" as well. diff --git a/testsuite/tests/checks/silent_exception_handlers/exc.adb b/testsuite/tests/checks/silent_exception_handlers/exc.adb index d8fa0e4b7..fc177e6d8 100644 --- a/testsuite/tests/checks/silent_exception_handlers/exc.adb +++ b/testsuite/tests/checks/silent_exception_handlers/exc.adb @@ -22,9 +22,14 @@ exception if I = 0 then Log ("0"); elsif I = 1 then - Log ("other"); + Log ("1"); else - raise; + case I is + when 2 => + Log ("2"); + when others => + raise + end case; end if; when E : others => -- NOFLAG I := 0;