aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2008-05-26 14:44:53 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-05-26 14:44:53 +0200
commit847ec40a79b07dce226253ead15a9c292354ed00 (patch)
tree7003421787a5bbf188842c7b630919a8abf77159 /gcc/ada/sem_ch12.adb
parentfcb4587ef66e7d3d5b2e580b1a737e73ae78bb23 (diff)
downloadgcc-847ec40a79b07dce226253ead15a9c292354ed00.zip
gcc-847ec40a79b07dce226253ead15a9c292354ed00.tar.gz
gcc-847ec40a79b07dce226253ead15a9c292354ed00.tar.bz2
sem_ch12.adb (Remove_Parent): Use specification of instance to retrieve generic parent...
2008-05-26 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Remove_Parent): Use specification of instance to retrieve generic parent, to handle properly the case where the instance is a child unit. Add guard to handle properly wrapper packages. Minor reformatting From-SVN: r135914
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb24
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 9a79d42..3efe7fc 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -10806,7 +10806,7 @@ package body Sem_Ch12 is
-------------------
procedure Remove_Parent (In_Body : Boolean := False) is
- S : Entity_Id := Current_Scope;
+ S : Entity_Id := Current_Scope;
-- S is the scope containing the instantiation just completed. The
-- scope stack contains the parent instances of the instantiation,
-- followed by the original S.
@@ -10828,7 +10828,6 @@ package body Sem_Ch12 is
if In_Open_Scopes (P) then
E := First_Entity (P);
-
while Present (E) loop
Set_Is_Immediately_Visible (E, True);
Next_Entity (E);
@@ -10866,20 +10865,29 @@ package body Sem_Ch12 is
-- of a child unit of its generic parent unit.
elsif S = Current_Scope
- and then Is_Generic_Instance (S)
- and then P = Scope (Generic_Parent (Parent (S)))
- and then (In_Package_Body (S) or else In_Private_Part (S))
+ and then Is_Generic_Instance (S)
then
- Set_In_Private_Part (P);
- Install_Private_Declarations (P);
+ declare
+ Par : constant Entity_Id :=
+ Generic_Parent
+ (Specification (Unit_Declaration_Node (S)));
+ begin
+ if Present (Par)
+ and then P = Scope (Par)
+ and then (In_Package_Body (S) or else In_Private_Part (S))
+ then
+ Set_In_Private_Part (P);
+ Install_Private_Declarations (P);
+ end if;
+ end;
end if;
end loop;
-- Reset visibility of entities in the enclosing scope
Set_Is_Hidden_Open_Scope (Current_Scope, False);
- Hidden := First_Elmt (Hidden_Entities);
+ Hidden := First_Elmt (Hidden_Entities);
while Present (Hidden) loop
Set_Is_Immediately_Visible (Node (Hidden), True);
Next_Elmt (Hidden);