[COMMITTED] ada: Simplify lookup of predecessor in homonym chain

Message ID 20230515094341.1408360-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Simplify lookup of predecessor in homonym chain |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès May 15, 2023, 9:43 a.m. UTC
  From: Ronan Desplanques <desplanques@adacore.com>

gcc/ada/

	* sem_ch8.adb (End_Scope): Simplify lookup of predecessor in
	homonym chain.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_ch8.adb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 6f858eea0f9..e4b3519bbaa 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -5066,7 +5066,6 @@  package body Sem_Ch8 is
          if Id /= Current_Entity (Id) then
             Prev := Current_Entity (Id);
             while Present (Prev)
-              and then Present (Homonym (Prev))
               and then Homonym (Prev) /= Id
             loop
                Prev := Homonym (Prev);
@@ -5074,7 +5073,7 @@  package body Sem_Ch8 is
 
             --  Skip to end of loop if Id is not in the visibility chain
 
-            if No (Prev) or else Homonym (Prev) /= Id then
+            if No (Prev) then
                goto Next_Ent;
             end if;