diff options
-rw-r--r-- | dist/gcc/INSTALL | 2 | ||||
-rw-r--r-- | src/vhdl/sem_specs.adb | 38 |
2 files changed, 28 insertions, 12 deletions
diff --git a/dist/gcc/INSTALL b/dist/gcc/INSTALL index e710f91..dc61131 100644 --- a/dist/gcc/INSTALL +++ b/dist/gcc/INSTALL @@ -1,6 +1,6 @@ Install file for the binary distribution of GHDL. -GHDL is Copyright 2002 - 2010 Tristan Gingold. +GHDL is Copyright 2002 - 2015 Tristan Gingold. GHDL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb index 718ee17..8c22e9c 100644 --- a/src/vhdl/sem_specs.adb +++ b/src/vhdl/sem_specs.adb @@ -1671,18 +1671,29 @@ package body Sem_Specs is function Get_Visible_Entity_Declaration (Comp: Iir_Component_Declaration) return Iir_Design_Unit is - function Is_Entity_Declaration (Decl : Iir) return Boolean is + -- Return the design_unit if DECL is an entity declaration or the + -- design unit of an entity declaration. Otherwise return Null_Iir. + -- This double check is needed as the interpretation may be both. + function Is_Entity_Declaration (Decl : Iir) return Iir is begin - return Get_Kind (Decl) = Iir_Kind_Design_Unit and then - Get_Kind (Get_Library_Unit (Decl)) = Iir_Kind_Entity_Declaration; + if Get_Kind (Decl) = Iir_Kind_Entity_Declaration then + return Get_Design_Unit (Decl); + elsif Get_Kind (Decl) = Iir_Kind_Design_Unit + and then + Get_Kind (Get_Library_Unit (Decl)) = Iir_Kind_Entity_Declaration + then + return Decl; + else + return Null_Iir; + end if; end Is_Entity_Declaration; + Name : constant Name_Id := Get_Identifier (Comp); Inter : Name_Interpretation_Type; - Name : Name_Id; Decl : Iir; + Res : Iir; Target_Lib : Iir; begin - Name := Get_Identifier (Comp); Inter := Get_Interpretation (Name); if Valid_Interpretation (Inter) then @@ -1693,8 +1704,9 @@ package body Sem_Specs is -- the instantiated component and that is directly visible -- (see 10.3), Decl := Get_Declaration (Inter); - if Is_Entity_Declaration (Decl) then - return Decl; + Res := Is_Entity_Declaration (Decl); + if Res /= Null_Iir then + return Res; end if; -- b) An entity declaration that has the same simple name that of @@ -1706,8 +1718,9 @@ package body Sem_Specs is Inter := Get_Under_Interpretation (Name); if Valid_Interpretation (Inter) then Decl := Get_Declaration (Inter); - if Is_Entity_Declaration (Decl) then - return Decl; + Res := Is_Entity_Declaration (Decl); + if Res /= Null_Iir then + return Res; end if; end if; end if; @@ -1730,8 +1743,11 @@ package body Sem_Specs is end loop; Decl := Libraries.Find_Primary_Unit (Target_Lib, Name); - if Decl /= Null_Iir and then Is_Entity_Declaration (Decl) then - return Decl; + if Decl /= Null_Iir then + Res := Is_Entity_Declaration (Decl); + if Res /= Null_Iir then + return Res; + end if; end if; end if; |