aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-05-29 18:47:14 +0200
committerTristan Gingold <tgingold@free.fr>2020-05-29 18:56:32 +0200
commit26a94c92410720f9ad3cdb2f163f3b8cca3a326d (patch)
treeb70c62f9e5c99762a4590fa77189985bc86c5b9c
parent0a51563e4e5989abe8becd1c060e06d4dec6024e (diff)
downloadghdl-26a94c92410720f9ad3cdb2f163f3b8cca3a326d.tar.gz
ghdl-26a94c92410720f9ad3cdb2f163f3b8cca3a326d.tar.bz2
ghdl-26a94c92410720f9ad3cdb2f163f3b8cca3a326d.zip
psl-nodes: set a location on false/true/one/EOS nodes. Fix #1345
-rw-r--r--src/libraries.adb31
-rw-r--r--src/options.adb2
-rw-r--r--src/psl/psl-nodes.adb11
-rw-r--r--src/psl/psl-nodes.ads2
4 files changed, 28 insertions, 18 deletions
diff --git a/src/libraries.adb b/src/libraries.adb
index 5e009d344..6b1570d5a 100644
--- a/src/libraries.adb
+++ b/src/libraries.adb
@@ -53,6 +53,20 @@ package body Libraries is
Report_Msg (Msgid_Error, Library, No_Source_Coord, Msg);
end Error_Lib_Msg;
+ procedure Create_Virtual_Locations
+ is
+ use Files_Map;
+ Library_Source_File : Source_File_Entry;
+ Command_Source_File : Source_File_Entry;
+ begin
+ Library_Source_File := Create_Virtual_Source_File
+ (Get_Identifier ("*libraries*"));
+ Command_Source_File := Create_Virtual_Source_File
+ (Get_Identifier ("*command line*"));
+ Command_Line_Location := File_To_Location (Command_Source_File);
+ Library_Location := File_To_Location (Library_Source_File);
+ end Create_Virtual_Locations;
+
-- Initialize paths table.
-- Set the local path.
procedure Init_Paths is
@@ -63,6 +77,8 @@ package body Libraries is
Local_Directory := Name_Nil;
Work_Directory := Name_Nil;
+
+ Create_Virtual_Locations;
end Init_Paths;
function Path_To_Id (Path : String) return Name_Id is
@@ -613,20 +629,6 @@ package body Libraries is
return True;
end Load_Library;
- procedure Create_Virtual_Locations
- is
- use Files_Map;
- Library_Source_File : Source_File_Entry;
- Command_Source_File : Source_File_Entry;
- begin
- Library_Source_File := Create_Virtual_Source_File
- (Get_Identifier ("*libraries*"));
- Command_Source_File := Create_Virtual_Source_File
- (Get_Identifier ("*command line*"));
- Command_Line_Location := File_To_Location (Command_Source_File);
- Library_Location := File_To_Location (Library_Source_File);
- end Create_Virtual_Locations;
-
-- Note: the scanner shouldn't be in use, since this procedure uses it.
procedure Load_Std_Library (Build_Standard : Boolean := True)
is
@@ -639,7 +641,6 @@ package body Libraries is
end if;
Flags.Create_Flag_String;
- Create_Virtual_Locations;
Vhdl.Std_Package.Create_First_Nodes;
diff --git a/src/options.adb b/src/options.adb
index 2e04f977e..31f5c89b5 100644
--- a/src/options.adb
+++ b/src/options.adb
@@ -35,7 +35,7 @@ package body Options is
begin
Std_Names.Std_Names_Initialize;
Libraries.Init_Paths;
- PSL.Nodes.Init;
+ PSL.Nodes.Init (Libraries.Library_Location);
PSL.Dump_Tree.Dump_Hdl_Node := Vhdl.Disp_Tree.Disp_Tree_For_Psl'Access;
Vhdl.Errors.Initialize;
end Initialize;
diff --git a/src/psl/psl-nodes.adb b/src/psl/psl-nodes.adb
index 3b3dac4be..d3a0d9320 100644
--- a/src/psl/psl-nodes.adb
+++ b/src/psl/psl-nodes.adb
@@ -304,23 +304,32 @@ package body PSL.Nodes is
Errors.Error_Kind (Msg, N);
end Failed;
- procedure Init is
+ procedure Init (Loc : Location_Type) is
begin
+ pragma Assert (Loc /= No_Location);
Nodet.Init;
+
if Create_Node (N_False) /= False_Node then
raise Internal_Error;
end if;
+ Set_Location (False_Node, Loc);
+
if Create_Node (N_True) /= True_Node then
raise Internal_Error;
end if;
+ Set_Location (True_Node, Loc);
+
if Create_Node (N_Number) /= One_Node then
raise Internal_Error;
end if;
Set_Value (One_Node, 1);
+ Set_Location (One_Node, Loc);
+
if Create_Node (N_EOS) /= EOS_Node then
raise Internal_Error;
end if;
Set_Hash (EOS_Node, 0);
+ Set_Location (EOS_Node, Loc);
PSL.Hash.Init;
end Init;
diff --git a/src/psl/psl-nodes.ads b/src/psl/psl-nodes.ads
index eb0ad4cb3..9418ae78a 100644
--- a/src/psl/psl-nodes.ads
+++ b/src/psl/psl-nodes.ads
@@ -460,7 +460,7 @@ package PSL.Nodes is
-- General methods.
- procedure Init;
+ procedure Init (Loc : Location_Type);
-- Get the number of the last node.
-- To be used to size lateral tables.