[Ada] Handling up-level references in loops within library-level declarations
authorGary Dismukes <dismukes@adacore.com>
Thu, 10 Oct 2019 15:25:36 +0000 (15:25 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 10 Oct 2019 15:25:36 +0000 (15:25 +0000)
commit7e536bfd0600341f83d85312cf9c909205ec4d18
tree2081bd613368ceea2a041f343f4afb2d377eb20f
parentebeabe0454975d7600af111a9461a85e75863641
[Ada] Handling up-level references in loops within library-level declarations

2019-10-10  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* exp_ch7.adb (Check_Unnesting_In_Decls_Or_Stmts): When
encountering a loop at the top level of a package declaration
list (that is, within the declarations of a package spec or
body) that has nested subprograms, call Unnest_Loop to create a
new library-level procedure that will contain the loop, to allow
for proper handling of up-level references from within nested
subprograms, such as to loop parameters.
(Unnest_Loop): New procedure that takes a loop statement and
creates a new procedure body to enclose the loop statement,
along with generating a call to the procedure.

From-SVN: r276836
gcc/ada/ChangeLog
gcc/ada/exp_ch7.adb