aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-07-16 14:12:03 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-16 14:12:03 +0000
commitfa42563af97ed3d3a77f580b8dccf9a61222ca4a (patch)
tree280261822eb7261c36288bceb347dfdfa0cc135a
parentdbe5b438d26161111824727534ef99f4d41e39c4 (diff)
downloadgcc-fa42563af97ed3d3a77f580b8dccf9a61222ca4a.zip
gcc-fa42563af97ed3d3a77f580b8dccf9a61222ca4a.tar.gz
gcc-fa42563af97ed3d3a77f580b8dccf9a61222ca4a.tar.bz2
[Ada] Unnesting: handle the semantic of Storage_Pool field
2018-07-16 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_unst.adb (Visit_Node): Handle the semantic of Storage_Pool field in relevant nodes: Allocate, Free, and return statements. From-SVN: r262725
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/exp_unst.adb16
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3dd8c84..13428e9 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2018-07-16 Ed Schonberg <schonberg@adacore.com>
+ * exp_unst.adb (Visit_Node): Handle the semantic of Storage_Pool field
+ in relevant nodes: Allocate, Free, and return statements.
+
+2018-07-16 Ed Schonberg <schonberg@adacore.com>
+
* sem_ch12.adb (Analyze_Package_Instantiation): Handle properly an
instance that carries an aspect Default_Storage_Pool that overrides a
default storage pool that applies to the generic unit. The aspect in
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index 9a2a482..464eaa0 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -812,7 +812,7 @@ package body Exp_Unst is
-- Similarly, the following constructs include a semantic
-- attribute Procedure_To_Call that must be handled like
- -- other calls.
+ -- other calls. Likewise for attribute Storage_Pool.
when N_Allocator
| N_Extended_Return_Statement
@@ -820,7 +820,9 @@ package body Exp_Unst is
| N_Simple_Return_Statement
=>
declare
+ Pool : constant Entity_Id := Storage_Pool (N);
Proc : constant Entity_Id := Procedure_To_Call (N);
+
begin
if Present (Proc)
and then Scope_Within (Proc, Subp)
@@ -828,6 +830,18 @@ package body Exp_Unst is
then
Append_Unique_Call ((N, Current_Subprogram, Proc));
end if;
+
+ if Present (Pool)
+ and then not Is_Library_Level_Entity (Pool)
+ and then Scope_Within_Or_Same (Scope (Pool), Subp)
+ then
+ Caller := Current_Subprogram;
+ Callee := Enclosing_Subprogram (Pool);
+
+ if Callee /= Caller then
+ Note_Uplevel_Ref (Pool, Empty, Caller, Callee);
+ end if;
+ end if;
end;
-- For an allocator with a qualified expression, check type