diff options
author | Arnaud Charlet <charlet@adacore.com> | 2020-06-03 03:42:19 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-15 09:43:00 -0400 |
commit | 8092c19930b6cdf3087825f9063cb830cd2de479 (patch) | |
tree | 65d79907beeb22253433c45c9b4976287b039ccb /gcc/ada/sinfo.adb | |
parent | 1c5f82019ab50806ff1a23e5be8db864e8da131a (diff) | |
download | gcc-8092c19930b6cdf3087825f9063cb830cd2de479.zip gcc-8092c19930b6cdf3087825f9063cb830cd2de479.tar.gz gcc-8092c19930b6cdf3087825f9063cb830cd2de479.tar.bz2 |
[Ada] Ongoing work for AI12-0212: container aggregates
gcc/ada/
* par-ch4.adb (P_Iterated_Component_Association): Extended to
recognzize the similar Iterated_Element_Association. This node
is only generated when an explicit Key_Expression is given.
Otherwise the distinction between the two iterated forms is done
during semantic analysis.
* sinfo.ads: New node N_Iterated_Element_Association, for
Ada202x container aggregates. New field Key_Expression.
* sinfo.adb: Subprograms for new node and newn field.
* sem_aggr.adb (Resolve_Iterated_Component_Association): Handle
the case where the Iteration_Scheme is an
Iterator_Specification.
* exp_aggr.adb (Wxpand_Iterated_Component): Handle a component
with an Iterated_Component_Association, generate proper loop
using given Iterator_Specification.
* exp_util.adb (Insert_Axtions): Handle new node as other
aggregate components.
* sem.adb, sprint.adb: Handle new node.
* tbuild.adb (Make_Implicit_Loop_Statement): Handle properly a
loop with an Iterator_ specification.
Diffstat (limited to 'gcc/ada/sinfo.adb')
-rw-r--r-- | gcc/ada/sinfo.adb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb index 9199af4..2d4b93e 100644 --- a/gcc/ada/sinfo.adb +++ b/gcc/ada/sinfo.adb @@ -1278,6 +1278,7 @@ package body Sinfo is or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Free_Statement or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Mod_Clause or else NT (N).Nkind = N_Modular_Type_Definition or else NT (N).Nkind = N_Number_Declaration @@ -2245,6 +2246,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Iteration_Scheme or else NT (N).Nkind = N_Quantified_Expression); return Node2 (N); @@ -2258,6 +2260,14 @@ package body Sinfo is return Node1 (N); end Itype; + function Key_Expression + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iterated_Element_Association); + return Node1 (N); + end Key_Expression; + function Kill_Range_Check (N : Node_Id) return Boolean is begin @@ -2367,7 +2377,8 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Component_Association - or else NT (N).Nkind = N_Iterated_Component_Association); + or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association); return List5 (N); end Loop_Actions; @@ -2375,6 +2386,7 @@ package body Sinfo is (N : Node_Id) return Node_Id is begin pragma Assert (False + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Iteration_Scheme or else NT (N).Nkind = N_Quantified_Expression); return Node4 (N); @@ -4762,6 +4774,7 @@ package body Sinfo is or else NT (N).Nkind = N_Expression_With_Actions or else NT (N).Nkind = N_Free_Statement or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Mod_Clause or else NT (N).Nkind = N_Modular_Type_Definition or else NT (N).Nkind = N_Number_Declaration @@ -5733,6 +5746,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Iteration_Scheme or else NT (N).Nkind = N_Quantified_Expression); Set_Node2_With_Parent (N, Val); @@ -5746,6 +5760,14 @@ package body Sinfo is Set_Node1 (N, Val); -- no parent, semantic field end Set_Itype; + procedure Set_Key_Expression + (N : Node_Id; Val : Entity_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Iterated_Element_Association); + Set_Node1_With_Parent (N, Val); + end Set_Key_Expression; + procedure Set_Kill_Range_Check (N : Node_Id; Val : Boolean := True) is begin @@ -5855,7 +5877,8 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Component_Association - or else NT (N).Nkind = N_Iterated_Component_Association); + or else NT (N).Nkind = N_Iterated_Component_Association + or else NT (N).Nkind = N_Iterated_Element_Association); Set_List5 (N, Val); -- semantic field, no parent set end Set_Loop_Actions; @@ -5863,6 +5886,7 @@ package body Sinfo is (N : Node_Id; Val : Node_Id) is begin pragma Assert (False + or else NT (N).Nkind = N_Iterated_Element_Association or else NT (N).Nkind = N_Iteration_Scheme or else NT (N).Nkind = N_Quantified_Expression); Set_Node4_With_Parent (N, Val); |