[COMMITTED] ada: Remove duplicated code in Proc_Next_Component_Or_Discriminant

Message ID 20230515094408.1408681-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Remove duplicated code in Proc_Next_Component_Or_Discriminant |

Checks

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

Commit Message

Marc Poulhiès May 15, 2023, 9:44 a.m. UTC
  From: Bob Duff <duff@adacore.com>

Proc_Next_Component_Or_Discriminant was duplicating the code
in Next_Component_Or_Discriminant.

gcc/ada/

	* einfo-utils.adb:
	(Proc_Next_Component_Or_Discriminant): Call
	Next_Component_Or_Discriminant.

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

---
 gcc/ada/einfo-utils.adb | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
  

Patch

diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
index dc379cbc852..a8220e2d133 100644
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -3219,11 +3219,7 @@  package body Einfo.Utils is
 
    procedure Proc_Next_Component_Or_Discriminant (N : in out Node_Id) is
    begin
-      N := Next_Entity (N);
-      while Present (N) loop
-         exit when Ekind (N) in E_Component | E_Discriminant;
-         N := Next_Entity (N);
-      end loop;
+      N := Next_Component_Or_Discriminant (N);
    end Proc_Next_Component_Or_Discriminant;
 
    procedure Proc_Next_Discriminant              (N : in out Node_Id) is