aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 12:00:18 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 12:00:18 +0200
commitc56a9ba447f72fccf12291589aec165cb99a65d2 (patch)
tree012fdf002a8460dafcfb42b7a4799ec65a6268f9 /gcc/ada/exp_ch4.adb
parent57d62f0cb7346e2a76e7e70c3b3726d0140ec662 (diff)
downloadgcc-c56a9ba447f72fccf12291589aec165cb99a65d2.zip
gcc-c56a9ba447f72fccf12291589aec165cb99a65d2.tar.gz
gcc-c56a9ba447f72fccf12291589aec165cb99a65d2.tar.bz2
[multiple changes]
2010-10-22 Thomas Quinot <quinot@adacore.com> * exp_ch5.adb, sem_ch5.adb, sinfo.ads, snames.ads-tmpl, par-ch5.adb: Minor reformatting. 2010-10-22 Geert Bosch <bosch@adacore.com> * stand.ads: Fix typo in comment. 2010-10-22 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb: Enable in-out parameter for functions. 2010-10-22 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Quantified_Expression): Handle properly loop iterators that are transformed into container iterators after analysis. * exp_ch4.adb (Expand_N_Quantified_Expression): Handle properly both iterator forms before rewriting as a loop. 2010-10-22 Brett Porter <porter@adacore.com> * a-locale.adb, a-locale.ads, locales.c: New files. * Makefile.rtl: Add a-locale * gcc-interface/Makefile.in: Add locales.c From-SVN: r165812
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb33
1 files changed, 25 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 613e9c8..31a43db 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -7428,13 +7428,13 @@ package body Exp_Ch4 is
procedure Expand_N_Quantified_Expression (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
- Iterator : constant Node_Id := Loop_Parameter_Specification (N);
Cond : constant Node_Id := Condition (N);
- Actions : List_Id;
- Decl : Node_Id;
- Test : Node_Id;
- Tnn : Entity_Id;
+ Actions : List_Id;
+ Decl : Node_Id;
+ I_Scheme : Node_Id;
+ Test : Node_Id;
+ Tnn : Entity_Id;
-- We expand:
@@ -7460,6 +7460,9 @@ package body Exp_Ch4 is
-- end if;
-- end loop;
+ -- In both cases, the iteration may be over a container, in which
+ -- case it is given by an iterator specification, not a loop.
+
begin
Actions := New_List;
Tnn := Make_Temporary (Loc, 'T');
@@ -7496,14 +7499,28 @@ package body Exp_Ch4 is
Make_Exit_Statement (Loc)));
end if;
+ if Present (Loop_Parameter_Specification (N)) then
+ I_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Loop_Parameter_Specification =>
+ Loop_Parameter_Specification (N));
+ else
+ I_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification => Iterator_Specification (N));
+ end if;
+
Append_To (Actions,
Make_Loop_Statement (Loc,
- Iteration_Scheme =>
- Make_Iteration_Scheme (Loc,
- Loop_Parameter_Specification => Iterator),
+ Iteration_Scheme => I_Scheme,
Statements => New_List (Test),
End_Label => Empty));
+ -- The components of the scheme have already been analyzed, and the
+ -- loop index declaration has been processed.
+
+ Set_Analyzed (Iteration_Scheme (Last (Actions)));
+
Rewrite (N,
Make_Expression_With_Actions (Loc,
Expression => New_Occurrence_Of (Tnn, Loc),