diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-02-13 06:50:25 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-02-13 06:50:25 +0100 |
commit | 38886eafc52f3c792c6693784d69748d4bedf12d (patch) | |
tree | e30941fbdcb4fe5a9088afa4f528dbc46765be23 /src/libraries.adb | |
parent | 91134d4f5a1220521cb9720a1feeb5d09c512bb9 (diff) | |
download | ghdl-38886eafc52f3c792c6693784d69748d4bedf12d.tar.gz ghdl-38886eafc52f3c792c6693784d69748d4bedf12d.tar.bz2 ghdl-38886eafc52f3c792c6693784d69748d4bedf12d.zip |
Library: unload library file after parsing it.
Diffstat (limited to 'src/libraries.adb')
-rw-r--r-- | src/libraries.adb | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/libraries.adb b/src/libraries.adb index a49931071..20a303c66 100644 --- a/src/libraries.adb +++ b/src/libraries.adb @@ -196,22 +196,6 @@ package body Libraries is end if; end Set_Work_Library_Path; - -- Open LIBRARY map file, return TRUE if successful. - function Set_Library_File_Name (Dir : Name_Id; - Library: Iir_Library_Declaration) - return Boolean - is - File_Name : constant String := Library_To_File_Name (Library); - Fe : Source_File_Entry; - begin - Fe := Files_Map.Load_Source_File (Dir, Get_Identifier (File_Name)); - if Fe = No_Source_File_Entry then - return False; - end if; - Scanner.Set_File (Fe); - return True; - end Set_Library_File_Name; - -- Every design unit is put in this hash table to be quickly found by -- its (primary) identifier. Unit_Hash_Length : constant Name_Id := 127; @@ -448,14 +432,21 @@ package body Libraries is Search_Library_In_Path (Library); Dir := Get_Library_Directory (Library); end if; - if Dir = Null_Identifier - or else not Set_Library_File_Name (Dir, Library) - then + if Dir = Null_Identifier then -- Not found. Set_Date (Library, Date_Valid'First); return False; end if; - File := Get_Current_Source_File; + + File := Files_Map.Load_Source_File + (Dir, Get_Identifier (Library_To_File_Name (Library))); + if File = No_Source_File_Entry then + -- Not found. + Set_Date (Library, Date_Valid'First); + return False; + end if; + + Scanner.Set_File (File); -- Parse header. Scan; @@ -641,7 +632,12 @@ package body Libraries is << Next_Line >> null; end loop; Set_Date (Library, Max_Date); - Close_File; + + Scanner.Close_File; + + -- Don't need the library file anymore. + Files_Map.Unload_Last_Source_File (File); + return True; end Load_Library; |