From: Piotr Trojanek Date: Tue, 11 May 2021 11:01:35 +0000 (+0200) Subject: [Ada] Simplify returning from Enclosing_Comp_Unit_Node X-Git-Tag: basepoints/gcc-13~6239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddbe7338f1ea50db4d39a925c6c530052ed288a4;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index cfb3293c3d0b..9d54309601ad 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; --------------------------