[Ada] Refine iteration from entities to formals
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 20 Jan 2022 19:12:52 +0000 (20:12 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 10 May 2022 08:19:26 +0000 (08:19 +0000)
commitd421523a42d50e1004d5bbe30e4c45b2b98f1a03
treef64dc658937598483de20636349aa013fd9b5ae9
parent3a978538036cd43d629c7b003c5ee6c8b3bf2c98
[Ada] Refine iteration from entities to formals

When matching formal parameters from spec and body it is cleaner and
more efficient to iterate with First_Formal/Next_Formal and not with
First_Entity/Next_Entity. The previous iteration could unintentionally
pick entities from within the subprogram body, e.g. objects declared
within the subprogram.

gcc/ada/

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Replace
First_Entity/Next_Entity with First_Formal/Next_Formal; rename
E1/E2 to F1/F2.
gcc/ada/sem_ch6.adb