Commit 999acab6 by Ed Schonberg Committed by Pierre-Marie de Rodat

[Ada] Unnesting: handle statement sequences that include an At_End handler

2018-05-29  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_unst.adb (Visit_Node): Handle statement sequences that include an
	At_End handler.

From-SVN: r260885
parent 944e24a3
2018-05-29 Ed Schonberg <schonberg@adacore.com>
* exp_unst.adb (Visit_Node): Handle statement sequences that include an
At_End handler.
2018-05-29 Eric Botcazou <ebotcazou@adacore.com> 2018-05-29 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.adb (List_Entities): Also recurse into blocks without label. * repinfo.adb (List_Entities): Also recurse into blocks without label.
......
...@@ -676,6 +676,16 @@ package body Exp_Unst is ...@@ -676,6 +676,16 @@ package body Exp_Unst is
end loop; end loop;
end; end;
elsif Nkind (N) = N_Handled_Sequence_Of_Statements
and then Present (At_End_Proc (N))
then
-- An At_End_Proc means there's a call from this block
-- to that subprogram.
Append_Unique_Call ((N, Current_Subprogram,
Entity (At_End_Proc (N))));
-- Handle a 'Access as a (potential) call -- Handle a 'Access as a (potential) call
elsif Nkind (N) = N_Attribute_Reference then elsif Nkind (N) = N_Attribute_Reference then
...@@ -850,10 +860,10 @@ package body Exp_Unst is ...@@ -850,10 +860,10 @@ package body Exp_Unst is
and then Chars (Enclosing_Subprogram (Ent)) /= Name_uParent and then Chars (Enclosing_Subprogram (Ent)) /= Name_uParent
and then and then
-- Constants, variables and exceptions are potentially -- Constants and variables are potentially
-- uplevel references to global declarations. -- uplevel references to global declarations.
(Ekind_In (Ent, E_Constant, E_Exception, E_Variable) (Ekind_In (Ent, E_Constant, E_Variable)
-- Formals are interesting, but not if being used as mere -- Formals are interesting, but not if being used as mere
-- names of parameters for name notation calls. -- names of parameters for name notation calls.
...@@ -1817,6 +1827,7 @@ package body Exp_Unst is ...@@ -1817,6 +1827,7 @@ package body Exp_Unst is
begin begin
if Present (STT.ARECnF) if Present (STT.ARECnF)
and then Nkind (CTJ.N) /= N_Attribute_Reference and then Nkind (CTJ.N) /= N_Attribute_Reference
and then Nkind (CTJ.N) /= N_Handled_Sequence_Of_Statements
then then
-- CTJ.N is a call to a subprogram which may require a pointer -- CTJ.N is a call to a subprogram which may require a pointer
-- to an activation record. The subprogram containing the call -- to an activation record. The subprogram containing the call
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment