aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-05-30 08:58:46 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-30 08:58:46 +0000
commite00ee732dd5ec5bbd663f685dfe1411028c71a5a (patch)
tree22557672b31ce741e5dc891169780ada2842cf22
parent392a7e19fd9750110d1931732ac34105460206f6 (diff)
downloadgcc-e00ee732dd5ec5bbd663f685dfe1411028c71a5a.zip
gcc-e00ee732dd5ec5bbd663f685dfe1411028c71a5a.tar.gz
gcc-e00ee732dd5ec5bbd663f685dfe1411028c71a5a.tar.bz2
[Ada] Unnesting: handle the semantic of Procedure_To_Call field
2018-05-30 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_unst.adb (Visit_Node): Handle the semantic Procedure_To_Call field in relevant nodes: Allocate, Free, and return statements. From-SVN: r260947
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/exp_unst.adb20
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1e810bb..dfe018d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2018-05-30 Ed Schonberg <schonberg@adacore.com>
+ * exp_unst.adb (Visit_Node): Handle the semantic Procedure_To_Call
+ field in relevant nodes: Allocate, Free, and return statements.
+
+2018-05-30 Ed Schonberg <schonberg@adacore.com>
+
* exp_unst.adb (Visit_Node): Do not traverse a Component_Association
that has not been analyzed, as will be the case for a nested aggregate
that is expanded into individual assignments.
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index 7935306..5469f28 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -715,6 +715,26 @@ package body Exp_Unst is
((N, Current_Subprogram, Entity (At_End_Proc (N))));
end if;
+ -- Similarly, the following constructs include a semantic
+ -- attribute Procedure_To_Call that must be handled like
+ -- other calls.
+
+ when N_Allocator
+ | N_Free_Statement
+ | N_Extended_Return_Statement
+ | N_Simple_Return_Statement
+ =>
+ declare
+ Proc : constant Entity_Id := Procedure_To_Call (N);
+ begin
+ if Present (Proc)
+ and then Scope_Within (Proc, Subp)
+ and then not Is_Imported (Proc)
+ then
+ Append_Unique_Call ((N, Current_Subprogram, Proc));
+ end if;
+ end;
+
-- A 'Access reference is a (potential) call.
-- Other attributes require special handling.