aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo.ads
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-05-17 21:02:59 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:51 -0400
commitff49b8053d16b0a565a02400ac0db81e5fd8f2cd (patch)
tree51744f051e71fbe19f3f25b6c35d31195cf7f21d /gcc/ada/sinfo.ads
parentc1fece377a93b1809243280fcbe01b143f105c9c (diff)
downloadgcc-ff49b8053d16b0a565a02400ac0db81e5fd8f2cd.zip
gcc-ff49b8053d16b0a565a02400ac0db81e5fd8f2cd.tar.gz
gcc-ff49b8053d16b0a565a02400ac0db81e5fd8f2cd.tar.bz2
[Ada] Ada_2020 AI12-0250 : Implement Iterator filters.
gcc/ada/ * par.adb (P_Iterator_Specification): Make public for use in other parser subprograms. * par-ch4.adb (P_Iterated_Component_Association): In Ada_2020, recognize use of Iterator_Specification in an element iterator. To simplify disambiguation between the two iterator forms, mark the component association as carrying an Iterator_Specification only when the element iterator (using "OF") is used. * par-ch5.adb (P_Loop_Parameter_Specification): In Ada_2020, parse iterator filter when present. (P_Iterator_Specification): Ditto. Remove declaration of P_Iterator_Specification, now in parent unit. * exp_ch5.adb (Expand_N_Loop_Statement): Apply Iterator filter when present. (Expand_Iterator_Loop_Over_Array): Ditto. (Expand_Iterator_Loop_Over_Container): Ditto. * sem_aggr.adb (Resolve_Array_Aggregate): Emit error nessage if an iterated component association includes a iterator specificcation with an element iterator, i.e. one that uses the OF keyword. * sem_ch5.adb (Analyze_Iterator_Specification): Analyze Iterator filter when present. (Analyze_Loop_Parameter_Specification): Ditto. * sinfo.adb: Suprogram bodies for new syntactic element Iterator_Filter. * sinfo.ads: Add Iterator_Filter to relevant nodes. Structure of Component_Association and Iteroted_Component_Association nodes is modified to take into account the possible presence of an iterator specification in the latter.
Diffstat (limited to 'gcc/ada/sinfo.ads')
-rw-r--r--gcc/ada/sinfo.ads34
1 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 24149b6..1dd31b0 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1993,7 +1993,7 @@ package Sinfo is
-- N_Raise_xxx_Error nodes since the transformation of these nodes is
-- handled by the back end (using the N_Push/N_Pop mechanism).
- -- Loop_Actions (List2-Sem)
+ -- Loop_Actions (List5-Sem)
-- A list present in Component_Association nodes in array aggregates.
-- Used to collect actions that must be executed within the loop because
-- they may need to be evaluated anew each time through.
@@ -4123,8 +4123,8 @@ package Sinfo is
-- N_Component_Association
-- Sloc points to first selector name
-- Choices (List1)
- -- Loop_Actions (List2-Sem)
-- Expression (Node3) (empty if Box_Present)
+ -- Loop_Actions (List5-Sem)
-- Box_Present (Flag15)
-- Inherited_Discriminant (Flag13)
@@ -4222,9 +4222,10 @@ package Sinfo is
-- N_Iterated_Component_Association
-- Sloc points to FOR
-- Defining_Identifier (Node1)
- -- Loop_Actions (List2-Sem)
+ -- Iterator_Specification (Node2) (set to Empty if no Iterator_Spec)
-- Expression (Node3)
-- Discrete_Choices (List4)
+ -- Loop_Actions (List5-Sem)
-- Box_Present (Flag15)
-- Note that Box_Present is always False, but it is intentionally added
@@ -5081,11 +5082,15 @@ package Sinfo is
-- LOOP_PARAMETER_SPECIFICATION ::=
-- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION
+ -- [Iterator_Filter]
+
+ -- Note; the optional Iterator_Filter is an Ada_2020 construct.
-- N_Loop_Parameter_Specification
-- Sloc points to first identifier
-- Defining_Identifier (Node1)
-- Reverse_Present (Flag15)
+ -- Iterator_Filter (Node3) (set to Empty if not present)
-- Discrete_Subtype_Definition (Node4)
-----------------------------------
@@ -5102,6 +5107,7 @@ package Sinfo is
-- Name (Node2)
-- Reverse_Present (Flag15)
-- Of_Present (Flag16)
+ -- Iterator_Filter (Node3) (set to Empty if not present)
-- Subtype_Indication (Node5)
-- Note: The Of_Present flag distinguishes the two forms
@@ -9826,6 +9832,9 @@ package Sinfo is
function Iteration_Scheme
(N : Node_Id) return Node_Id; -- Node2
+ function Iterator_Filter
+ (N : Node_Id) return Node_Id; -- Node3
+
function Iterator_Specification
(N : Node_Id) return Node_Id; -- Node2
@@ -9866,7 +9875,7 @@ package Sinfo is
(N : Node_Id) return Elist_Id; -- Elist1
function Loop_Actions
- (N : Node_Id) return List_Id; -- List2
+ (N : Node_Id) return List_Id; -- List5
function Loop_Parameter_Specification
(N : Node_Id) return Node_Id; -- Node4
@@ -10929,6 +10938,9 @@ package Sinfo is
procedure Set_Is_Write
(N : Node_Id; Val : Boolean := True); -- Flag5
+ procedure Set_Iterator_Filter
+ (N : Node_Id; Val : Node_Id); -- Node3
+
procedure Set_Iteration_Scheme
(N : Node_Id; Val : Node_Id); -- Node2
@@ -10972,7 +10984,7 @@ package Sinfo is
(N : Node_Id; Val : Elist_Id); -- Elist1
procedure Set_Loop_Actions
- (N : Node_Id; Val : List_Id); -- List2
+ (N : Node_Id; Val : List_Id); -- List5
procedure Set_Loop_Parameter_Specification
(N : Node_Id; Val : Node_Id); -- Node4
@@ -11876,17 +11888,17 @@ package Sinfo is
N_Component_Association =>
(1 => True, -- Choices (List1)
- 2 => False, -- Loop_Actions (List2-Sem)
+ 2 => False, -- unused
3 => True, -- Expression (Node3)
4 => False, -- unused
- 5 => False), -- unused
+ 5 => True), -- Loop_Actions (List5-Sem);
N_Iterated_Component_Association =>
(1 => True, -- Defining_Identifier (Node1)
- 2 => True, -- Loop_Actions (List2-Sem)
+ 2 => True, -- Iterator_Specification
3 => True, -- Expression (Node3)
4 => True, -- Discrete_Choices (List4)
- 5 => False), -- unused
+ 5 => True), -- Loop_Actions (List5-Sem);
N_Delta_Aggregate =>
(1 => False, -- Unused
@@ -12201,7 +12213,7 @@ package Sinfo is
2 => False, -- unused
3 => False, -- unused
4 => True, -- Discrete_Subtype_Definition (Node4)
- 5 => False), -- unused
+ 5 => True), -- Iterator_Filter (Node5)
N_Iterator_Specification =>
(1 => True, -- Defining_Identifier (Node1)
@@ -13430,6 +13442,7 @@ package Sinfo is
pragma Inline (Is_Task_Body_Procedure);
pragma Inline (Is_Task_Master);
pragma Inline (Is_Write);
+ pragma Inline (Iterator_Filter);
pragma Inline (Iteration_Scheme);
pragma Inline (Itype);
pragma Inline (Kill_Range_Check);
@@ -13794,6 +13807,7 @@ package Sinfo is
pragma Inline (Set_Is_Task_Body_Procedure);
pragma Inline (Set_Is_Task_Master);
pragma Inline (Set_Is_Write);
+ pragma Inline (Set_Iterator_Filter);
pragma Inline (Set_Iteration_Scheme);
pragma Inline (Set_Iterator_Specification);
pragma Inline (Set_Itype);