aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-06-16 09:58:09 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-27 04:05:17 -0400
commit2c3bc159a8ca5f128e934b0357900c40b9d965fb (patch)
tree54eb7cf0343c811e07438d1b70e93d1cd8f0bceb /gcc
parentc893f4a5e0ec94d20bdc5786de3d91f2a13f668e (diff)
downloadgcc-2c3bc159a8ca5f128e934b0357900c40b9d965fb.zip
gcc-2c3bc159a8ca5f128e934b0357900c40b9d965fb.tar.gz
gcc-2c3bc159a8ca5f128e934b0357900c40b9d965fb.tar.bz2
[Ada] Remove obsolete special case in Switch_View
gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Add commentary for a nesting issue with parent handling and private view switching. (Switch_View): Do not skip specific private-dependent subtypes.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch12.adb29
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index b3a4ad4..e09a7ac 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -12029,6 +12029,19 @@ package body Sem_Ch12 is
end if;
Restore_Hidden_Primitives (Vis_Prims_List);
+
+ -- Restore the private views that were made visible when the body of
+ -- the instantiation was created. Note that, in the case where one of
+ -- these private views is declared in the parent, there is a nesting
+ -- issue with the calls to Install_Parent and Remove_Parent made in
+ -- between above with In_Body set to True, because these calls also
+ -- want to swap and restore this private view respectively. In this
+ -- case, the call to Install_Parent does nothing, but the call to
+ -- Remove_Parent does restore the private view, thus undercutting the
+ -- call to Restore_Private_Views. That's OK under the condition that
+ -- the two mechanisms swap exactly the same entities, in particular
+ -- the private entities dependent on the primary private entities.
+
Restore_Private_Views (Act_Decl_Id);
-- Remove the current unit from visibility if this is an instance
@@ -16680,19 +16693,9 @@ package body Sem_Ch12 is
end if;
while Present (Priv_Elmt) loop
- Priv_Sub := (Node (Priv_Elmt));
-
- -- We avoid flipping the subtype if the Etype of its full view is
- -- private because this would result in a malformed subtype. This
- -- occurs when the Etype of the subtype full view is the full view of
- -- the base type (and since the base types were just switched, the
- -- subtype is pointing to the wrong view). This is currently the case
- -- for tagged record types, access types (maybe more?) and needs to
- -- be resolved. ???
-
- if Present (Full_View (Priv_Sub))
- and then not Is_Private_Type (Etype (Full_View (Priv_Sub)))
- then
+ Priv_Sub := Node (Priv_Elmt);
+
+ if Present (Full_View (Priv_Sub)) then
Prepend_Elmt (Full_View (Priv_Sub), Exchanged_Views);
Exchange_Declarations (Priv_Sub);
end if;