summaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-22 09:36:41 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-22 09:36:41 +0000
commitf37e6e70431d6cb6c018921b3b39814e3a250752 (patch)
treeb51589b3c1031d88407ce19e8674a52d97c3acfa /gcc/ada/sinfo.ads
parent51eba752fbfb644cb6b8b3438038527e9d0fe83a (diff)
downloadgcc-f37e6e70431d6cb6c018921b3b39814e3a250752.tar.gz
2010-10-22 Robert Dewar <dewar@adacore.com>
* sem_util.ads, sem_util.adb, sem_aux.ads, sem_aux.adb (Is_Generic_Formal): Moved from Sem_Util to Sem_Aux. 2010-10-22 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Iterator_Loop): New subprogram, implements new iterator forms over arrays and containers, in loops and quantified expressions. * exp_util.adb (Insert_Actions): include N_Iterator_Specification. * par-ch4.adb (P_Quantified_Expression): Handle iterator specifications. * par-ch5.adb (P_Iterator_Specification): New subprogram. Modify P_Iteration_Scheme to handle both loop forms. * sem.adb: Handle N_Iterator_Specification. * sem_ch5.adb, sem_ch5.ads (Analyze_Iterator_Specification): New subprogram. * sinfo.adb, sinfo.ads: New node N_Iterator_Specification. N_Iteration_Scheme can now include an Iterator_Specification. Ditto for N_Quantified_Expression. * snames.ads-tmpl: Add names Cursor, Element, Element_Type, No_Element, and Previous, to support iterators over predefined containers. * sprint.adb: Handle N_Iterator_Specification. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165811 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sinfo.ads')
-rw-r--r--gcc/ada/sinfo.ads52
1 files changed, 49 insertions, 3 deletions
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index f47892a0ab1..2b145cca14c 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1544,6 +1544,10 @@ package Sinfo is
-- is used for properly setting out of range values for use by pragmas
-- Initialize_Scalars and Normalize_Scalars.
+ -- Of_Present (Flag16)
+ -- Present in N_Iterastor_Specification nodes, to mark the Ada2012 iterator
+ -- form over arrays and containers.
+
-- Original_Discriminant (Node2-Sem)
-- Present in identifiers. Used in references to discriminants that
-- appear in generic units. Because the names of the discriminants may be
@@ -3829,6 +3833,7 @@ package Sinfo is
-- N_Quantified_Expression
-- Sloc points to FOR
+ -- Iterator_Specification (Node2) (set to Empty if not Present)
-- Loop_Parameter_Specification (Node4)
-- Condition (Node1)
-- All_Present (Flag15)
@@ -4164,7 +4169,11 @@ package Sinfo is
--------------------------
-- ITERATION_SCHEME ::=
- -- while CONDITION | for LOOP_PARAMETER_SPECIFICATION
+ -- while CONDITION | for LOOP_PARAMETER_SPECIFICATION |
+ -- for ITERATOR_SPECIFICATION
+
+ -- Only one of (Iterator_Specification, Loop_Parameter_Specification)
+ -- is present at a time, the other one is empty.
-- Gigi restriction: This expander ensures that the type of the
-- Condition field is always Standard.Boolean, even if the type
@@ -4174,6 +4183,7 @@ package Sinfo is
-- Sloc points to WHILE or FOR
-- Condition (Node1) (set to Empty if FOR case)
-- Condition_Actions (List3-Sem)
+ -- Iterator_Specification (Node2) (set to Empty if not Present)
-- Loop_Parameter_Specification (Node4) (set to Empty if WHILE case)
---------------------------------------
@@ -4189,6 +4199,22 @@ package Sinfo is
-- Reverse_Present (Flag15)
-- Discrete_Subtype_Definition (Node4)
+ ----------------------------------
+ -- 5.5.1 Iterator specification --
+ ----------------------------------
+
+ -- ITERATOR_SPECIFICATION ::=
+ -- DEFINING_IDENTIFIER in [reverse] NAME
+ -- DEFINING_IDENTIFIER [: SUBTYPE_INDICATION] of [reverse] NAME
+
+ -- N_Iterator_Specification
+ -- Sloc points to defining identifier
+ -- Defining_Identifier (Node1)
+ -- Name (Node2)
+ -- Reverse_Present (Flag15)
+ -- Of_Present (Flag16)
+ -- Subtype_Indication (Node5)
+
--------------------------
-- 5.6 Block Statement --
--------------------------
@@ -7500,6 +7526,7 @@ package Sinfo is
N_Formal_Type_Declaration,
N_Full_Type_Declaration,
N_Incomplete_Type_Declaration,
+ N_Iterator_Specification,
N_Loop_Parameter_Specification,
N_Object_Declaration,
N_Parameterized_Expression,
@@ -8492,6 +8519,9 @@ package Sinfo is
function Iteration_Scheme
(N : Node_Id) return Node_Id; -- Node2
+ function Iterator_Specification
+ (N : Node_Id) return Node_Id; -- Node2
+
function Itype
(N : Node_Id) return Entity_Id; -- Node1
@@ -8612,6 +8642,9 @@ package Sinfo is
function Object_Definition
(N : Node_Id) return Node_Id; -- Node4
+ function Of_Present
+ (N : Node_Id) return Boolean; -- Flag16
+
function Original_Discriminant
(N : Node_Id) return Node_Id; -- Node2
@@ -9446,6 +9479,9 @@ package Sinfo is
procedure Set_Iteration_Scheme
(N : Node_Id; Val : Node_Id); -- Node2
+ procedure Set_Iterator_Specification
+ (N : Node_Id; Val : Node_Id); -- Node2
+
procedure Set_Itype
(N : Node_Id; Val : Entity_Id); -- Node1
@@ -9566,6 +9602,9 @@ package Sinfo is
procedure Set_Object_Definition
(N : Node_Id; Val : Node_Id); -- Node4
+ procedure Set_Of_Present
+ (N : Node_Id; Val : Boolean := True); -- Flag16
+
procedure Set_Original_Discriminant
(N : Node_Id; Val : Node_Id); -- Node2
@@ -10492,7 +10531,7 @@ package Sinfo is
N_Quantified_Expression =>
(1 => True, -- Condition (Node1)
- 2 => False, -- unused
+ 2 => True, -- Iterator_Specification
3 => False, -- unused
4 => True, -- Loop_Parameter_Specification (Node4)
5 => False), -- Etype (Node5-Sem)
@@ -10576,7 +10615,7 @@ package Sinfo is
N_Iteration_Scheme =>
(1 => True, -- Condition (Node1)
- 2 => False, -- unused
+ 2 => True, -- Iterator_Specification (Node2)
3 => False, -- Condition_Actions (List3-Sem)
4 => True, -- Loop_Parameter_Specification (Node4)
5 => False), -- unused
@@ -10588,6 +10627,13 @@ package Sinfo is
4 => True, -- Discrete_Subtype_Definition (Node4)
5 => False), -- unused
+ N_Iterator_Specification =>
+ (1 => True, -- Defining_Identifier (Node1)
+ 2 => True, -- Name (Node2)
+ 3 => False, -- Unused
+ 4 => False, -- Unused
+ 5 => True), -- Subtype_Indication (Node5)
+
N_Block_Statement =>
(1 => True, -- Identifier (Node1)
2 => True, -- Declarations (List2)