From: Eric Botcazou Date: Sun, 2 Aug 2020 12:14:50 +0000 (+0200) Subject: [Ada] Use helper function in Freeze_Subprogram_Body X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e98f6ed1e2e9f0cfaac5dad0e279091d88fd353f;p=gcc.git [Ada] Use helper function in Freeze_Subprogram_Body gcc/ada/ * sem_ch12.adb (Freeze_Subprogram_Body): Call Package_Freeze_Node to retrieve the freeze node for the enclosing body of the generic. --- diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 78e84d47687..e2b14bfa477 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -8980,8 +8980,8 @@ package body Sem_Ch12 is is Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node); Par : constant Entity_Id := Scope (Gen_Unit); - E_G_Id : Entity_Id; Enc_G : Entity_Id; + Enc_G_F : Node_Id; Enc_I : Node_Id; F_Node : Node_Id; @@ -9128,14 +9128,6 @@ package body Sem_Ch12 is and then Enc_G /= Enc_I and then Earlier (Inst_Node, Gen_Body) then - if Nkind (Enc_G) = N_Package_Body then - E_G_Id := - Corresponding_Spec (Enc_G); - else pragma Assert (Nkind (Enc_G) = N_Package_Body_Stub); - E_G_Id := - Corresponding_Spec (Proper_Body (Unit (Library_Unit (Enc_G)))); - end if; - -- Freeze package that encloses instance, and place node after the -- package that encloses generic. If enclosing package is already -- frozen we have to assume it is at the proper place. This may be a @@ -9163,10 +9155,10 @@ package body Sem_Ch12 is -- Freeze enclosing subunit before instance - Ensure_Freeze_Node (E_G_Id); + Enc_G_F := Package_Freeze_Node (Enc_G); - if not Is_List_Member (Freeze_Node (E_G_Id)) then - Insert_After (Enc_G, Freeze_Node (E_G_Id)); + if not Is_List_Member (Enc_G_F) then + Insert_After (Enc_G, Enc_G_F); end if; Insert_Freeze_Node_For_Instance (Inst_Node, F_Node);