diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-09-16 08:11:37 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-09-16 08:11:37 +0200 |
commit | f9ea178139736775d8be7f8880cb532f56430b49 (patch) | |
tree | 3738c3a7f0313fcfa0e97dd624a4786abe64f927 /src/vhdl/translate/trans-chap2.adb | |
parent | 39893478c7a6e35363dbd0ba4de1c5de430d68ce (diff) | |
download | ghdl-f9ea178139736775d8be7f8880cb532f56430b49.tar.gz ghdl-f9ea178139736775d8be7f8880cb532f56430b49.tar.bz2 ghdl-f9ea178139736775d8be7f8880cb532f56430b49.zip |
Handle macro-expansion of instantiation of declaration with interface type.
Diffstat (limited to 'src/vhdl/translate/trans-chap2.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap2.adb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 1ce10e22b..0d6f73e2b 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -764,6 +764,11 @@ package body Trans.Chap2 is Interface_List : O_Inter_List; Prev_Subprg_Instance : Subprgs.Subprg_Instance_Stack; begin + -- Skip uninstantiated package that have to be macro-expanded. + if Get_Macro_Expanded_Flag (Decl) then + return; + end if; + Info := Add_Info (Decl, Kind_Package); if Is_Nested then @@ -881,6 +886,10 @@ package body Trans.Chap2 is Prev_Subprg_Instance : Subprgs.Subprg_Instance_Stack; Mark : Id_Mark_Type; begin + if Get_Macro_Expanded_Flag (Spec) then + return; + end if; + if Is_Nested then Push_Identifier_Prefix (Mark, Get_Identifier (Spec)); end if; @@ -1139,6 +1148,16 @@ package body Trans.Chap2 is when Kind_Expr => Dest.all := (Kind => Kind_Expr, Expr_Node => Src.Expr_Node); + when Kind_Package_Instance => + Dest.all := + (Kind => Kind_Package_Instance, + Package_Instance_Spec_Var => Src.Package_Instance_Spec_Var, + Package_Instance_Body_Var => Src.Package_Instance_Body_Var, + Package_Instance_Elab_Subprg => + Src.Package_Instance_Elab_Subprg, + Package_Instance_Spec_Scope => Src.Package_Instance_Spec_Scope, + Package_Instance_Body_Scope => Src.Package_Instance_Body_Scope); + when others => raise Internal_Error; end case; @@ -1264,16 +1283,14 @@ package body Trans.Chap2 is Inter := Chain; while Inter /= Null_Iir loop case Get_Kind (Inter) is - when Iir_Kind_Interface_Constant_Declaration => + when Iir_Kind_Interface_Constant_Declaration + | Iir_Kind_Interface_Package_Declaration => Orig := Sem_Inst.Get_Origin (Inter); Orig_Info := Get_Info (Orig); Info := Add_Info (Inter, Orig_Info.Kind); Copy_Info (Info, Orig_Info); - when Iir_Kind_Interface_Package_Declaration => - null; - when others => raise Internal_Error; end case; @@ -1316,6 +1333,9 @@ package body Trans.Chap2 is Info : Ortho_Info_Acc; Interface_List : O_Inter_List; begin + -- Canon must have replaced instatiation by generic-mapped packages. + pragma Assert (not Get_Macro_Expanded_Flag (Spec)); + Instantiate_Info_Package (Inst); Info := Get_Info (Inst); |