aboutsummaryrefslogtreecommitdiffstats
path: root/src/libraries.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-24 18:37:53 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-24 21:14:11 +0200
commit37d33fb7b2f43e275a98d22561080758fcdfc601 (patch)
tree8062ee7a9c9a2970814d33a7ca1d39b82c47d5f3 /src/libraries.adb
parent9c4bbedd7baf23e491e52361643c308623bba1f3 (diff)
downloadghdl-37d33fb7b2f43e275a98d22561080758fcdfc601.tar.gz
ghdl-37d33fb7b2f43e275a98d22561080758fcdfc601.tar.bz2
ghdl-37d33fb7b2f43e275a98d22561080758fcdfc601.zip
libraries: add Get_Library_No_Create.
Diffstat (limited to 'src/libraries.adb')
-rw-r--r--src/libraries.adb24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libraries.adb b/src/libraries.adb
index 15b0fd3bc..30128749d 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -716,11 +716,8 @@ package body Libraries is
Set_Visible_Flag (Work_Library, True);
end Load_Work_Library;
- -- Get or create a library from an identifier.
- function Get_Library (Ident: Name_Id; Loc : Location_Type)
- return Iir_Library_Declaration
- is
- Library: Iir_Library_Declaration;
+ function Get_Library_No_Create (Ident : Name_Id)
+ return Iir_Library_Declaration is
begin
-- The library work is a little bit special.
if Ident = Std_Names.Name_Work or else Ident = Work_Library_Name then
@@ -730,16 +727,23 @@ package body Libraries is
end if;
-- Check if the library has already been loaded.
- Library := Vhdl.Utils.Find_Name_In_Chain (Libraries_Chain, Ident);
+ return Vhdl.Utils.Find_Name_In_Chain (Libraries_Chain, Ident);
+ end Get_Library_No_Create;
+
+ -- Get or create a library from an identifier.
+ function Get_Library (Ident: Name_Id; Loc : Location_Type)
+ return Iir_Library_Declaration
+ is
+ Library: Iir_Library_Declaration;
+ begin
+ Library := Get_Library_No_Create (Ident);
if Library /= Null_Iir then
return Library;
end if;
-- This is a new library.
- if Ident = Std_Names.Name_Std then
- -- Load_std_library must have been called before.
- raise Internal_Error;
- end if;
+ -- Load_std_library must have been called before.
+ pragma Assert (Ident /= Std_Names.Name_Std);
Library := Create_Iir (Iir_Kind_Library_Declaration);
Set_Location (Library, Library_Location);