aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-06-19 06:17:53 +0200
committerTristan Gingold <tgingold@free.fr>2020-06-19 06:19:49 +0200
commit5c4dd6ea37990668c5cd29713a91d462943d89c2 (patch)
treead345a5d905278927ea5ca3d4832ddf592fe7249 /src
parent167285ec30c5e51bf9bd501e56581c05d09eaebe (diff)
downloadghdl-5c4dd6ea37990668c5cd29713a91d462943d89c2.tar.gz
ghdl-5c4dd6ea37990668c5cd29713a91d462943d89c2.tar.bz2
ghdl-5c4dd6ea37990668c5cd29713a91d462943d89c2.zip
vhdl: slightly improve error message for libraries.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem.adb14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb
index 8311e816f..8c13b24ce 100644
--- a/src/vhdl/vhdl-sem.adb
+++ b/src/vhdl/vhdl-sem.adb
@@ -3141,6 +3141,14 @@ package body Vhdl.Sem is
Set_Library_Declaration (Decl, Lib);
Sem_Scopes.Add_Name (Lib, Ident, False);
Set_Visible_Flag (Lib, True);
+
+ -- Override the location of the library. Even if the library is
+ -- not really declared by the library clause (it is almost pre-
+ -- declared), it improves error messages.
+ -- Note: library clauses of dependences will overwrite the location,
+ -- defeating the purpose of it.
+ Location_Copy (Lib, Decl);
+
Xref_Ref (Decl, Lib);
end if;
end Sem_Library_Clause;
@@ -3368,6 +3376,12 @@ package body Vhdl.Sem is
Sem_Scopes.Add_Name (Libraries.Std_Library, Std_Names.Name_Std, False);
Sem_Scopes.Add_Name (Library, Std_Names.Name_Work, False);
Sem_Scopes.Use_All_Names (Standard_Package);
+
+ -- Use pre-defined locations for STD and WORK library (as they may
+ -- be later overriden).
+ Set_Location (Libraries.Std_Library, Libraries.Library_Location);
+ Set_Location (Library, Libraries.Library_Location);
+
if Get_Dependence_List (Design_Unit) = Null_Iir_List then
Set_Dependence_List (Design_Unit, Create_Iir_List);
end if;