diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-28 20:10:28 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-28 20:10:28 +0100 |
commit | 7cbd526468940a0146c7e89a1393f656d1de7c71 (patch) | |
tree | 03c04bf4617b8c7a6c0ded94b0d775e98bbd5687 /src | |
parent | 3930d6a2c064e16ad71de3bc19dacdbd9b96c11a (diff) | |
download | ghdl-7cbd526468940a0146c7e89a1393f656d1de7c71.tar.gz ghdl-7cbd526468940a0146c7e89a1393f656d1de7c71.tar.bz2 ghdl-7cbd526468940a0146c7e89a1393f656d1de7c71.zip |
vhdl-sem_decls: do not reassign type declarator on subtype aliases
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/vhdl-sem_decls.adb | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb index 47f77e917..32daadeb6 100644 --- a/src/vhdl/vhdl-sem_decls.adb +++ b/src/vhdl/vhdl-sem_decls.adb @@ -852,22 +852,28 @@ package body Vhdl.Sem_Decls is return; end if; - if not Is_Anonymous_Type_Definition (Def) - and then Get_Kind (Def) /= Iir_Kind_Protected_Type_Declaration - and then Get_Kind (Def) /= Iir_Kind_Interface_Type_Definition - then - -- There is no added constraints and therefore the subtype - -- declaration is in fact an alias of the type. Create a copy so - -- that it has its own type declarator. - -- (Except for protected types). - Def := Copy_Subtype_Indication (Def); - Location_Copy (Def, Decl); - Set_Subtype_Type_Mark (Def, Ind); - Set_Subtype_Indication (Decl, Def); + if not Is_Anonymous_Type_Definition (Def) then + if Get_Kind (Def) /= Iir_Kind_Protected_Type_Declaration + and then Get_Kind (Def) /= Iir_Kind_Interface_Type_Definition + then + -- There is no added constraints and therefore the subtype + -- declaration is in fact an alias of the type. Create a copy so + -- that it has its own type declarator. + -- (Except for protected types). + Def := Copy_Subtype_Indication (Def); + Location_Copy (Def, Decl); + Set_Subtype_Type_Mark (Def, Ind); + Set_Subtype_Indication (Decl, Def); + Set_Type_Declarator (Def, Decl); + else + -- Do not set type_declarator, as there is no copy. + null; + end if; + else + Set_Type_Declarator (Def, Decl); end if; Set_Type (Decl, Def); - Set_Type_Declarator (Def, Decl); Name_Visible (Decl); if Is_Global then Set_Type_Has_Signal (Def); |