aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorMarc Poulhiès <poulhies@adacore.com>2023-01-16 15:05:37 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-16 10:30:56 +0200
commit3c09e25e2c9cbd980a711fe4f654374fbf8affc0 (patch)
tree4e654cf960b26910d1b4e49a2103cc6449e7a8d2 /gcc/ada
parentc850b1a7dcd13a3f1c288b5334188ba7406c2141 (diff)
downloadgcc-3c09e25e2c9cbd980a711fe4f654374fbf8affc0.zip
gcc-3c09e25e2c9cbd980a711fe4f654374fbf8affc0.tar.gz
gcc-3c09e25e2c9cbd980a711fe4f654374fbf8affc0.tar.bz2
ada: Trivial refactoring in Instantiate_*_Body
Factor out Par_Vis/Install_Parent/Par_Installed in Instantiate_Package_Body and Instantiate_Subprogram_Body. gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Simplify if/then/else. (Instantiate_Subprogram_Body): Likewise.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_ch12.adb16
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 39ceaf7..c4cc641 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -12175,9 +12175,6 @@ package body Sem_Ch12 is
and then Nkind (Gen_Id) = N_Expanded_Name
then
Par_Ent := Entity (Prefix (Gen_Id));
- Par_Vis := Is_Immediately_Visible (Par_Ent);
- Install_Parent (Par_Ent, In_Body => True);
- Par_Installed := True;
elsif Ekind (Scope (Gen_Unit)) = E_Generic_Package
and then Ekind (Scope (Act_Decl_Id)) = E_Package
@@ -12189,12 +12186,12 @@ package body Sem_Ch12 is
Par_Ent := Entity
(Prefix (Name (Get_Unit_Instantiation_Node
(Scope (Act_Decl_Id)))));
- Par_Vis := Is_Immediately_Visible (Par_Ent);
- Install_Parent (Par_Ent, In_Body => True);
- Par_Installed := True;
elsif Is_Child_Unit (Gen_Unit) then
Par_Ent := Scope (Gen_Unit);
+ end if;
+
+ if Present (Par_Ent) then
Par_Vis := Is_Immediately_Visible (Par_Ent);
Install_Parent (Par_Ent, In_Body => True);
Par_Installed := True;
@@ -12611,12 +12608,11 @@ package body Sem_Ch12 is
and then Nkind (Gen_Id) = N_Expanded_Name
then
Par_Ent := Entity (Prefix (Gen_Id));
- Par_Vis := Is_Immediately_Visible (Par_Ent);
- Install_Parent (Par_Ent, In_Body => True);
- Par_Installed := True;
-
elsif Is_Child_Unit (Gen_Unit) then
Par_Ent := Scope (Gen_Unit);
+ end if;
+
+ if Present (Par_Ent) then
Par_Vis := Is_Immediately_Visible (Par_Ent);
Install_Parent (Par_Ent, In_Body => True);
Par_Installed := True;