aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-05-07 06:29:39 +0200
committerTristan Gingold <tgingold@free.fr>2022-05-07 06:31:58 +0200
commit2886f0582984bc4948f716d82762c50fc3302064 (patch)
treebde3fe6f5d0a6b7165886d10e642113d72bee30f /src/ortho
parent2804d2726adbb6cca68731526a0df54ebd767beb (diff)
downloadghdl-2886f0582984bc4948f716d82762c50fc3302064.tar.gz
ghdl-2886f0582984bc4948f716d82762c50fc3302064.tar.bz2
ghdl-2886f0582984bc4948f716d82762c50fc3302064.zip
ortho/debug: handle aggregates of record-subtype
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/debug/ortho_debug-disp.adb3
-rw-r--r--src/ortho/debug/ortho_debug.adb26
-rw-r--r--src/ortho/debug/ortho_debug.private.ads3
3 files changed, 25 insertions, 7 deletions
diff --git a/src/ortho/debug/ortho_debug-disp.adb b/src/ortho/debug/ortho_debug-disp.adb
index 29d07fae4..0baf97f21 100644
--- a/src/ortho/debug/ortho_debug-disp.adb
+++ b/src/ortho/debug/ortho_debug-disp.adb
@@ -617,8 +617,7 @@ package body Ortho_Debug.Disp is
begin
Put ('{');
El := C.Rec_Els;
- pragma Assert (C.Ctype.Kind = ON_Record_Type);
- Field := C.Ctype.Rec_Elements;
+ Field := Get_Record_Elements (C.Ctype);
if El /= null then
loop
Set_Mark;
diff --git a/src/ortho/debug/ortho_debug.adb b/src/ortho/debug/ortho_debug.adb
index 2feda5932..ca33f2454 100644
--- a/src/ortho/debug/ortho_debug.adb
+++ b/src/ortho/debug/ortho_debug.adb
@@ -269,6 +269,11 @@ package body Ortho_Debug is
then
return;
end if;
+ if T1.Kind = ON_Record_Subtype and then T2.Kind = ON_Record_Subtype
+ then
+ -- TODO: check elements.
+ return;
+ end if;
if not Disable_Checks then
raise Type_Error;
end if;
@@ -919,18 +924,29 @@ package body Ortho_Debug is
when ON_Array_Type =>
return Atype.El_Type;
when others =>
- raise Syntax_Error;
+ raise Syntax_Error;
end case;
end Get_Array_El_Type;
+ function Get_Record_Elements (Atype : O_Tnode) return O_Fnode is
+ begin
+ case Atype.Kind is
+ when ON_Record_Subtype =>
+ return Atype.Subrec_Elements;
+ when ON_Record_Type =>
+ return Atype.Rec_Elements;
+ when others =>
+ raise Syntax_Error;
+ end case;
+ end Get_Record_Elements;
+
procedure Start_Record_Aggr (List : out O_Record_Aggr_List; Atype : O_Tnode)
is
subtype O_Cnode_Aggregate is O_Cnode_Type (OC_Record_Aggregate);
Res : O_Cnode;
+ Els : O_Fnode;
begin
- if Atype.Kind /= ON_Record_Type then
- raise Type_Error;
- end if;
+ Els := Get_Record_Elements (Atype);
Check_Complete_Type (Atype);
Res := new O_Cnode_Aggregate'(Kind => OC_Record_Aggregate,
Ctype => Atype,
@@ -938,7 +954,7 @@ package body Ortho_Debug is
Rec_Els => null);
List.Res := Res;
List.Last := null;
- List.Field := Atype.Rec_Elements;
+ List.Field := Els;
end Start_Record_Aggr;
procedure New_Record_Aggr_El (List : in out O_Record_Aggr_List;
diff --git a/src/ortho/debug/ortho_debug.private.ads b/src/ortho/debug/ortho_debug.private.ads
index 662a14711..4e302deaa 100644
--- a/src/ortho/debug/ortho_debug.private.ads
+++ b/src/ortho/debug/ortho_debug.private.ads
@@ -30,6 +30,9 @@ private
-- Return the type of elements of array type/subtype ATYPE.
function Get_Array_El_Type (Atype : O_Tnode) return O_Tnode;
+ -- Return the elements of a record or sub-record.
+ function Get_Record_Elements (Atype : O_Tnode) return O_Fnode;
+
-- Return the base type of T.
-- function Get_Base_Type (T : O_Tnode) return O_Tnode;