public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] [Ada] Small housekeeping work in Check_Private_View
@ 2020-08-22 21:55 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d404166beebeb937bd24081d240d8d0d91aed0d9
commit d404166beebeb937bd24081d240d8d0d91aed0d9
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Thu Jan 16 16:53:39 2020 +0100
[Ada] Small housekeeping work in Check_Private_View
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch12.adb (Check_Private_View): Clean up implementation of
second main case, when the generic sees the private declaration.
Diff:
---
gcc/ada/sem_ch12.adb | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index be46867324f..71e1212de66 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -7431,35 +7431,25 @@ package body Sem_Ch12 is
and then Present (Full_View (T))
and then not In_Open_Scopes (Scope (T))
then
- -- In the generic, the full type was visible. Save the private
- -- entity, for subsequent exchange.
+ -- In the generic, the full declaration was visible
Switch_View (T);
elsif Has_Private_View (N)
and then not Is_Private_Type (T)
and then not Has_Been_Exchanged (T)
- and then Etype (Get_Associated_Node (N)) /= T
+ and then (not In_Open_Scopes (Scope (T))
+ or else Nkind (Parent (N)) = N_Subtype_Declaration)
then
- -- Only the private declaration was visible in the generic. If
- -- the type appears in a subtype declaration, the subtype in the
+ -- In the generic, only the private declaration was visible
+
+ -- If the type appears in a subtype declaration, the subtype in
-- instance must have a view compatible with that of its parent,
-- which must be exchanged (see corresponding code in Restore_
- -- Private_Views). Otherwise, if the type is defined in a parent
- -- unit, leave full visibility within instance, which is safe.
-
- if In_Open_Scopes (Scope (Base_Type (T)))
- and then not Is_Private_Type (Base_Type (T))
- and then Comes_From_Source (Base_Type (T))
- then
- null;
+ -- Private_Views) so we make an exception to the open scope rule.
- elsif Nkind (Parent (N)) = N_Subtype_Declaration
- or else not In_Private_Part (Scope (Base_Type (T)))
- then
- Prepend_Elmt (T, Exchanged_Views);
- Exchange_Declarations (Etype (Get_Associated_Node (N)));
- end if;
+ Prepend_Elmt (T, Exchanged_Views);
+ Exchange_Declarations (Etype (Get_Associated_Node (N)));
-- For composite types with inconsistent representation exchange
-- component types accordingly.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 21:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:55 [gcc/devel/autopar_devel] [Ada] Small housekeeping work in Check_Private_View Giuliano Belinassi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).