diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-11 20:55:41 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-12 06:44:25 +0100 |
commit | f3eba1ac1ef38f7708154e594ede3f72db78105b (patch) | |
tree | 7164e9edc9996a4eca8bf53dba7de372f4df5b77 /src/vhdl/vhdl-utils.adb | |
parent | 783074260833160bfc3ef8f9203147e752e6269e (diff) | |
download | ghdl-f3eba1ac1ef38f7708154e594ede3f72db78105b.tar.gz ghdl-f3eba1ac1ef38f7708154e594ede3f72db78105b.tar.bz2 ghdl-f3eba1ac1ef38f7708154e594ede3f72db78105b.zip |
vhdl: clear associated_type in Sem_Generic_Association_Chain
So that it is cleared after use.
Diffstat (limited to 'src/vhdl/vhdl-utils.adb')
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index 05c1dc0ee..6bd200cc3 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -691,6 +691,65 @@ package body Vhdl.Utils is end if; end Is_Copyback_Parameter; + procedure Set_Interface_Associated (Inter_Chain : Iir; Assoc_Chain : Iir) + is + Inter, Assoc_Inter, Assoc : Iir; + begin + Assoc := Assoc_Chain; + Assoc_Inter := Inter_Chain; + while Assoc /= Null_Node loop + Inter := Get_Association_Interface (Assoc, Assoc_Inter); + case Iir_Kinds_Interface_Declaration (Get_Kind (Inter)) is + when Iir_Kind_Interface_Type_Declaration => + declare + Tdef : constant Iir := Get_Interface_Type_Definition (Inter); + begin + pragma Assert (Get_Associated_Type (Tdef) = Null_Iir); + Set_Associated_Type (Tdef, Get_Actual_Type (Assoc)); + end; + -- TODO: subprograms ? + when Iir_Kind_Interface_Package_Declaration => + pragma Assert (Get_Associated_Package (Inter) = Null_Iir); + Set_Associated_Package + (Inter, Get_Named_Entity (Get_Actual (Assoc))); + when Iir_Kinds_Interface_Subprogram_Declaration => + pragma Assert (Get_Associated_Subprogram (Inter) = Null_Iir); + Set_Associated_Subprogram + (Inter, Get_Named_Entity (Get_Actual (Assoc))); + when Iir_Kinds_Interface_Object_Declaration + | Iir_Kind_Interface_Terminal_Declaration => + null; + end case; + Next_Association_Interface (Assoc, Assoc_Inter); + end loop; + end Set_Interface_Associated; + + procedure Clear_Interface_Associated (Inter_Chain : Iir) + is + Inter : Iir; + begin + Inter := Inter_Chain; + while Inter /= Null_Node loop + case Iir_Kinds_Interface_Declaration (Get_Kind (Inter)) is + when Iir_Kind_Interface_Type_Declaration => + declare + Tdef : constant Iir := Get_Interface_Type_Definition (Inter); + begin + Set_Associated_Type (Tdef, Null_Iir); + end; + -- TODO: subprograms ? + when Iir_Kind_Interface_Package_Declaration => + Set_Associated_Package (Inter, Null_Iir); + when Iir_Kinds_Interface_Subprogram_Declaration => + Set_Associated_Subprogram (Inter, Null_Iir); + when Iir_Kinds_Interface_Object_Declaration + | Iir_Kind_Interface_Terminal_Declaration => + null; + end case; + Inter := Get_Chain (Inter); + end loop; + end Clear_Interface_Associated; + function Find_Name_In_Flist (List : Iir_Flist; Lit : Name_Id) return Iir is El : Iir; |