* [Ada] Couple of small cleanups for Cloned_Subtype
@ 2022-07-05 8:30 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-05 8:30 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
No functional changes.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_util.adb (Make_Subtype_From_Expr): Do not set field to Empty.
* sem_util.adb (Visit_Itype): Remove ??? comment.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1686 bytes --]
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -10213,8 +10213,8 @@ package body Exp_Util is
elsif Is_Class_Wide_Type (Unc_Typ) then
declare
- CW_Subtype : Entity_Id;
- EQ_Typ : Entity_Id := Empty;
+ CW_Subtype : constant Entity_Id :=
+ New_Class_Wide_Subtype (Unc_Typ, E);
begin
-- A class-wide equivalent type is not needed on VM targets
@@ -10237,11 +10237,10 @@ package body Exp_Util is
Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ))));
end if;
- EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E);
+ Set_Equivalent_Type
+ (CW_Subtype, Make_CW_Equivalent_Type (Unc_Typ, E));
end if;
- CW_Subtype := New_Class_Wide_Subtype (Unc_Typ, E);
- Set_Equivalent_Type (CW_Subtype, EQ_Typ);
Set_Cloned_Subtype (CW_Subtype, Base_Type (Unc_Typ));
return New_Occurrence_Of (CW_Subtype, Loc);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25146,8 +25146,7 @@ package body Sem_Util is
end if;
-- If a record subtype is simply copied, the entity list will be
- -- shared. Thus cloned_Subtype must be set to indicate the sharing.
- -- ??? What does this do?
+ -- shared, so Cloned_Subtype must be set to indicate this.
if Ekind (Itype) in E_Class_Wide_Subtype | E_Record_Subtype then
Set_Cloned_Subtype (New_Itype, Itype);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-05 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 8:30 [Ada] Couple of small cleanups for Cloned_Subtype Pierre-Marie de Rodat
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).