From: Ed Schonberg Date: Wed, 30 May 2018 08:58:46 +0000 (+0000) Subject: [Ada] Unnesting: handle the semantic of Procedure_To_Call field X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e00ee732dd5ec5bbd663f685dfe1411028c71a5a;p=gcc.git [Ada] Unnesting: handle the semantic of Procedure_To_Call field 2018-05-30 Ed Schonberg 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1e810bbdf61..dfe018dbd79 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-05-30 Ed Schonberg + + * 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 * exp_unst.adb (Visit_Node): Do not traverse a Component_Association diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 7935306996e..5469f28c79d 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.