summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb42
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 04fd5c07f7d..5717f9eecad 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -7399,17 +7399,20 @@ 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);
+ 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;
- -- We expand
+ -- We expand:
+
-- for all X in range => Cond
- -- into
+
+ -- into:
+
-- R := True;
-- for all X in range loop
-- if not Cond then
@@ -7417,9 +7420,9 @@ package body Exp_Ch4 is
-- exit;
-- end if;
-- end loop;
- --
+
-- Conversely, an existentially quantified expression becomes:
- --
+
-- R := False;
-- for all X in range loop
-- if Cond then
@@ -7431,9 +7434,10 @@ package body Exp_Ch4 is
begin
Actions := New_List;
Tnn := Make_Temporary (Loc, 'T');
- Decl := Make_Object_Declaration (Loc,
- Defining_Identifier => Tnn,
- Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc));
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Tnn,
+ Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc));
Append_To (Actions, Decl);
@@ -7442,22 +7446,23 @@ package body Exp_Ch4 is
Test :=
Make_If_Statement (Loc,
- Condition =>
+ Condition =>
Make_Op_Not (Loc, Relocate_Node (Cond)),
Then_Statements => New_List (
Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Tnn, Loc),
+ Name => New_Occurrence_Of (Tnn, Loc),
Expression => New_Occurrence_Of (Standard_False, Loc)),
Make_Exit_Statement (Loc)));
+
else
Set_Expression (Decl, New_Occurrence_Of (Standard_False, Loc));
Test :=
Make_If_Statement (Loc,
- Condition => Relocate_Node (Cond),
+ Condition => Relocate_Node (Cond),
Then_Statements => New_List (
Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Tnn, Loc),
+ Name => New_Occurrence_Of (Tnn, Loc),
Expression => New_Occurrence_Of (Standard_True, Loc)),
Make_Exit_Statement (Loc)));
end if;
@@ -7467,8 +7472,8 @@ package body Exp_Ch4 is
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification => Iterator),
- Statements => New_List (Test),
- End_Label => Empty));
+ Statements => New_List (Test),
+ End_Label => Empty));
Rewrite (N,
Make_Expression_With_Actions (Loc,
@@ -7507,10 +7512,10 @@ package body Exp_Ch4 is
function In_Left_Hand_Side (Comp : Node_Id) return Boolean is
begin
return (Nkind (Parent (Comp)) = N_Assignment_Statement
- and then Comp = Name (Parent (Comp)))
+ and then Comp = Name (Parent (Comp)))
or else (Present (Parent (Comp))
- and then Nkind (Parent (Comp)) in N_Subexpr
- and then In_Left_Hand_Side (Parent (Comp)));
+ and then Nkind (Parent (Comp)) in N_Subexpr
+ and then In_Left_Hand_Side (Parent (Comp)));
end In_Left_Hand_Side;
-- Start of processing for Expand_N_Selected_Component
@@ -7625,7 +7630,6 @@ package body Exp_Ch4 is
Disc := First_Discriminant (Ptyp);
Dcon := First_Elmt (Discriminant_Constraint (Ptyp));
-
Discr_Loop : while Present (Dcon) loop
Dval := Node (Dcon);