From ddbe7338f1ea50db4d39a925c6c530052ed288a4 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Tue, 11 May 2021 13:01:35 +0200 Subject: [PATCH] [Ada] Simplify returning from Enclosing_Comp_Unit_Node gcc/ada/ * sem_util.adb (Enclosing_Comp_Unit_Node): When the loop exits the Current_Node is either an N_Compilation_Unit node or Empty, so simply return it without redundant checks. --- gcc/ada/sem_util.adb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index cfb3293..9d54309 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8037,11 +8037,7 @@ package body Sem_Util is Current_Node := Parent (Current_Node); end loop; - if Nkind (Current_Node) /= N_Compilation_Unit then - return Empty; - else - return Current_Node; - end if; + return Current_Node; end Enclosing_Comp_Unit_Node; -------------------------- -- 2.7.4