aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-08-02 14:14:50 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-21 03:22:45 -0400
commite98f6ed1e2e9f0cfaac5dad0e279091d88fd353f (patch)
tree63c16f44004b7ac05ef83232542e6d838defb007
parentbd4dc93d42b0148cf24a8a4738a0f27d1be580f8 (diff)
downloadgcc-e98f6ed1e2e9f0cfaac5dad0e279091d88fd353f.zip
gcc-e98f6ed1e2e9f0cfaac5dad0e279091d88fd353f.tar.gz
gcc-e98f6ed1e2e9f0cfaac5dad0e279091d88fd353f.tar.bz2
[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.
-rw-r--r--gcc/ada/sem_ch12.adb16
1 files changed, 4 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 78e84d4..e2b14bf 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);