diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-06-12 08:03:24 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-06-12 08:03:24 +0200 |
commit | 8a3f67db595be25637b4edc65f18138b48ccdac6 (patch) | |
tree | 7988fec65793fd9b71a9030a42839f40879f5cbf /src | |
parent | e726be425740402ab57e91a66d2cd8b812974bf4 (diff) | |
download | ghdl-8a3f67db595be25637b4edc65f18138b48ccdac6.tar.gz ghdl-8a3f67db595be25637b4edc65f18138b48ccdac6.tar.bz2 ghdl-8a3f67db595be25637b4edc65f18138b48ccdac6.zip |
ortho: allow selected element from an union.
Minor cleanups.
Diffstat (limited to 'src')
-rw-r--r-- | src/ortho/debug/ortho_debug.adb | 4 | ||||
-rw-r--r-- | src/ortho/gcc/ortho_gcc.ads | 4 | ||||
-rw-r--r-- | src/ortho/llvm/ortho_llvm.ads | 4 | ||||
-rw-r--r-- | src/ortho/ortho_nodes.common.ads | 4 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 9 |
5 files changed, 12 insertions, 13 deletions
diff --git a/src/ortho/debug/ortho_debug.adb b/src/ortho/debug/ortho_debug.adb index ca67b33e4..b1ec1b645 100644 --- a/src/ortho/debug/ortho_debug.adb +++ b/src/ortho/debug/ortho_debug.adb @@ -967,7 +967,9 @@ package body Ortho_Debug is is subtype O_Lnode_Selected_Element is O_Lnode_Type (OL_Selected_Element); begin - if Rec.Rtype.Kind /= ON_Record_Type then + if Rec.Rtype.Kind /= ON_Record_Type + and then Rec.Rtype.Kind /= ON_Union_Type + then raise Type_Error; end if; if Rec.Rtype /= El.Parent then diff --git a/src/ortho/gcc/ortho_gcc.ads b/src/ortho/gcc/ortho_gcc.ads index 7ed83d241..6f43be4cb 100644 --- a/src/ortho/gcc/ortho_gcc.ads +++ b/src/ortho/gcc/ortho_gcc.ads @@ -290,8 +290,8 @@ package Ortho_Gcc is function New_Slice (Arr : O_Lnode; Res_Type : O_Tnode; Index : O_Enode) return O_Lnode; - -- Get an element of a record. - -- Type of REC must be a record type. + -- Get an element of a record or a union. + -- Type of REC must be a record or a union type. function New_Selected_Element (Rec : O_Lnode; El : O_Fnode) return O_Lnode; diff --git a/src/ortho/llvm/ortho_llvm.ads b/src/ortho/llvm/ortho_llvm.ads index 931977bf8..69a850fb7 100644 --- a/src/ortho/llvm/ortho_llvm.ads +++ b/src/ortho/llvm/ortho_llvm.ads @@ -313,8 +313,8 @@ package Ortho_LLVM is function New_Slice (Arr : O_Lnode; Res_Type : O_Tnode; Index : O_Enode) return O_Lnode; - -- Get an element of a record. - -- Type of REC must be a record type. + -- Get an element of a record or a union. + -- Type of REC must be a record or a union type. function New_Selected_Element (Rec : O_Lnode; El : O_Fnode) return O_Lnode; diff --git a/src/ortho/ortho_nodes.common.ads b/src/ortho/ortho_nodes.common.ads index 178187482..f9caf32a7 100644 --- a/src/ortho/ortho_nodes.common.ads +++ b/src/ortho/ortho_nodes.common.ads @@ -284,8 +284,8 @@ package ORTHO_NODES is function New_Slice (Arr : O_Lnode; Res_Type : O_Tnode; Index : O_Enode) return O_Lnode; - -- Get an element of a record. - -- Type of REC must be a record type. + -- Get an element of a record or a union. + -- Type of REC must be a record or a union type. function New_Selected_Element (Rec : O_Lnode; El : O_Fnode) return O_Lnode; diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index a6ba4c9a5..bc82209f8 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -1979,8 +1979,7 @@ package body Trans.Chap3 is end Handle_Anonymous_Subtypes; -- Note: boolean types are translated by translate_bool_type_definition! - procedure Translate_Type_Definition - (Def : Iir; With_Vars : Boolean := True) + procedure Translate_Type_Definition (Def : Iir; With_Vars : Boolean := True) is Info : Ortho_Info_Acc; Base_Info : Type_Info_Acc; @@ -2264,10 +2263,9 @@ package body Trans.Chap3 is procedure Translate_Anonymous_Type_Definition (Def : Iir; Transient : Boolean) is + Type_Info : constant Type_Info_Acc := Get_Info (Def); Mark : Id_Mark_Type; - Type_Info : Type_Info_Acc; begin - Type_Info := Get_Info (Def); if Type_Info /= null then return; end if; @@ -2282,11 +2280,10 @@ package body Trans.Chap3 is procedure Translate_Object_Subtype (Decl : Iir; With_Vars : Boolean := True) is + Def : constant Iir := Get_Type (Decl); Mark : Id_Mark_Type; Mark2 : Id_Mark_Type; - Def : Iir; begin - Def := Get_Type (Decl); if Is_Anonymous_Type_Definition (Def) then Push_Identifier_Prefix (Mark, Get_Identifier (Decl)); Push_Identifier_Prefix (Mark2, "OT"); |