aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-10-09 20:47:26 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-10-09 20:47:26 +0000
commit3fc40cd783cb149d7d6c328def33606ec17ab15f (patch)
tree5464e584db086ae7844c699ab4fedf3aea926122 /gcc/ada/exp_ch4.adb
parent367601d1238a0b997ec9321ab2c58e5557d972c2 (diff)
downloadgcc-3fc40cd783cb149d7d6c328def33606ec17ab15f.zip
gcc-3fc40cd783cb149d7d6c328def33606ec17ab15f.tar.gz
gcc-3fc40cd783cb149d7d6c328def33606ec17ab15f.tar.bz2
[multiple changes]
2017-10-09 Hristian Kirtchev <kirtchev@adacore.com> * sem_unit.adb (Find_Enclosing_Scope): Do not treat a block statement as a scoping construct when it is byproduct of exception handling. 2017-10-09 Hristian Kirtchev <kirtchev@adacore.com> * sinfo.ads: Update table Is_Syntactic_Field to reflect the nature of semantic field Target of node N_Call_Marker. 2017-10-09 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Allocator): Reject properly an allocator that attempts to copy a limited value, when the allocator is the expression in an expression function. 2017-10-09 Joel Brobecker <brobecker@adacore.com> * doc/share/conf.py: Tell the style checker that this is a Python fragment, and therefore that pyflakes should not be run to validate this file. 2017-10-09 Eric Botcazou <ebotcazou@adacore.com> * einfo.ads (Is_Boolean_Type): Add pragma Inline. (Is_Entity_Name): Likewise. (Is_String_Type): Likewise. * sem_type.adb (Full_View_Covers): Do not test Is_Private_Type here and remove useless comparisons on the base types. (Covers): Use simple tests for Standard_Void_Type. Move up cheap tests on T2. Always test Is_Private_Type before Full_View_Covers. 2017-10-09 Bob Duff <duff@adacore.com> * exp_ch4.adb: Minor refactoring. From-SVN: r253568
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb145
1 files changed, 73 insertions, 72 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 0fe189b..770341c 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5451,12 +5451,10 @@ package body Exp_Ch4 is
Typ : constant Entity_Id := Etype (N);
Actions : List_Id;
- Cnn : Entity_Id;
Decl : Node_Id;
Expr : Node_Id;
New_If : Node_Id;
New_N : Node_Id;
- Ptr_Typ : Entity_Id;
begin
-- Check for MINIMIZED/ELIMINATED overflow mode
@@ -5560,65 +5558,66 @@ package body Exp_Ch4 is
Process_If_Case_Statements (N, Then_Actions (N));
Process_If_Case_Statements (N, Else_Actions (N));
- -- Generate:
- -- type Ann is access all Typ;
-
- Ptr_Typ := Make_Temporary (Loc, 'A');
-
- Insert_Action (N,
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Ptr_Typ,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present => True,
- Subtype_Indication => New_Occurrence_Of (Typ, Loc))));
+ declare
+ Cnn : constant Entity_Id := Make_Temporary (Loc, 'C', N);
+ Ptr_Typ : constant Entity_Id := Make_Temporary (Loc, 'A');
+ begin
+ -- Generate:
+ -- type Ann is access all Typ;
- -- Generate:
- -- Cnn : Ann;
+ Insert_Action (N,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Ptr_Typ,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication => New_Occurrence_Of (Typ, Loc))));
- Cnn := Make_Temporary (Loc, 'C', N);
+ -- Generate:
+ -- Cnn : Ann;
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Cnn,
- Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc));
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Cnn,
+ Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc));
- -- Generate:
- -- if Cond then
- -- Cnn := <Thenx>'Unrestricted_Access;
- -- else
- -- Cnn := <Elsex>'Unrestricted_Access;
- -- end if;
+ -- Generate:
+ -- if Cond then
+ -- Cnn := <Thenx>'Unrestricted_Access;
+ -- else
+ -- Cnn := <Elsex>'Unrestricted_Access;
+ -- end if;
- New_If :=
- Make_Implicit_If_Statement (N,
- Condition => Relocate_Node (Cond),
- Then_Statements => New_List (
- Make_Assignment_Statement (Sloc (Thenx),
- Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Thenx),
- Attribute_Name => Name_Unrestricted_Access))),
+ New_If :=
+ Make_Implicit_If_Statement (N,
+ Condition => Relocate_Node (Cond),
+ Then_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Thenx),
+ Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => Relocate_Node (Thenx),
+ Attribute_Name => Name_Unrestricted_Access))),
- Else_Statements => New_List (
- Make_Assignment_Statement (Sloc (Elsex),
- Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Elsex),
- Attribute_Name => Name_Unrestricted_Access))));
+ Else_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Elsex),
+ Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => Relocate_Node (Elsex),
+ Attribute_Name => Name_Unrestricted_Access))));
- -- Preserve the original context for which the if statement is being
- -- generated. This is needed by the finalization machinery to prevent
- -- the premature finalization of controlled objects found within the
- -- if statement.
+ -- Preserve the original context for which the if statement is
+ -- being generated. This is needed by the finalization machinery
+ -- to prevent the premature finalization of controlled objects
+ -- found within the if statement.
- Set_From_Conditional_Expression (New_If);
+ Set_From_Conditional_Expression (New_If);
- New_N :=
- Make_Explicit_Dereference (Loc,
- Prefix => New_Occurrence_Of (Cnn, Loc));
+ New_N :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Occurrence_Of (Cnn, Loc));
+ end;
-- If the result is an unconstrained array and the if expression is in a
-- context other than the initializing expression of the declaration of
@@ -5677,31 +5676,33 @@ package body Exp_Ch4 is
-- and replace the if expression by a reference to Cnn
- Cnn := Make_Temporary (Loc, 'C', N);
-
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Cnn,
- Object_Definition => New_Occurrence_Of (Typ, Loc));
+ declare
+ Cnn : constant Node_Id := Make_Temporary (Loc, 'C', N);
+ begin
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Cnn,
+ Object_Definition => New_Occurrence_Of (Typ, Loc));
- New_If :=
- Make_Implicit_If_Statement (N,
- Condition => Relocate_Node (Cond),
+ New_If :=
+ Make_Implicit_If_Statement (N,
+ Condition => Relocate_Node (Cond),
- Then_Statements => New_List (
- Make_Assignment_Statement (Sloc (Thenx),
- Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
- Expression => Relocate_Node (Thenx))),
+ Then_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Thenx),
+ Name => New_Occurrence_Of (Cnn, Sloc (Thenx)),
+ Expression => Relocate_Node (Thenx))),
- Else_Statements => New_List (
- Make_Assignment_Statement (Sloc (Elsex),
- Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
- Expression => Relocate_Node (Elsex))));
+ Else_Statements => New_List (
+ Make_Assignment_Statement (Sloc (Elsex),
+ Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
+ Expression => Relocate_Node (Elsex))));
- Set_Assignment_OK (Name (First (Then_Statements (New_If))));
- Set_Assignment_OK (Name (First (Else_Statements (New_If))));
+ Set_Assignment_OK (Name (First (Then_Statements (New_If))));
+ Set_Assignment_OK (Name (First (Else_Statements (New_If))));
- New_N := New_Occurrence_Of (Cnn, Loc);
+ New_N := New_Occurrence_Of (Cnn, Loc);
+ end;
-- Regular path using Expression_With_Actions