summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/parse.adb23
-rw-r--r--src/vhdl/sem.adb1
2 files changed, 20 insertions, 4 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 5430e05..fef7347 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -6298,8 +6298,10 @@ package body Parse is
is
Res : Iir_Generate_Statement;
Alt_Label : Name_Id;
+ Alt_Loc : Location_Type;
Cond : Iir;
Clause : Iir;
+ Bod : Iir;
Last : Iir;
begin
if Label = Null_Identifier then
@@ -6327,6 +6329,7 @@ package body Parse is
-- In fact the parsed condition was an alternate label.
Alt_Label := Get_Identifier (Cond);
+ Alt_Loc := Get_Location (Cond);
Free_Iir (Cond);
else
Error_Msg_Parse ("alternative label must be an identifier");
@@ -6345,8 +6348,14 @@ package body Parse is
Expect (Tok_Generate);
Scan;
- Set_Generate_Statement_Body
- (Clause, Parse_Generate_Statement_Body (Res, Alt_Label));
+ Bod := Parse_Generate_Statement_Body (Res, Alt_Label);
+
+ if Alt_Label /= Null_Identifier then
+ -- Set location on the label, for xrefs.
+ Set_Location (Bod, Alt_Loc);
+ end if;
+
+ Set_Generate_Statement_Body (Clause, Bod);
if Last /= Null_Iir then
Set_Generate_Else_Clause (Last, Clause);
@@ -6369,6 +6378,7 @@ package body Parse is
if Current_Token = Tok_Identifier then
Alt_Label := Current_Identifier;
+ Alt_Loc := Get_Token_Location;
-- Skip identifier
Scan;
@@ -6385,8 +6395,13 @@ package body Parse is
Expect (Tok_Generate);
Scan;
- Set_Generate_Statement_Body
- (Clause, Parse_Generate_Statement_Body (Res, Alt_Label));
+ Bod := Parse_Generate_Statement_Body (Res, Alt_Label);
+ if Alt_Label /= Null_Identifier then
+ -- Set location on the label, for xrefs.
+ Set_Location (Bod, Alt_Loc);
+ end if;
+
+ Set_Generate_Statement_Body (Clause, Bod);
Set_Generate_Else_Clause (Last, Clause);
end if;
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index 1380568..608bfc8 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -795,6 +795,7 @@ package body Sem is
return Null_Iir;
end if;
Set_Named_Entity (Block_Spec, Res);
+ Xref_Ref (Gen_Spec, Res);
Set_Prefix (Block_Spec, Block_Name);
Set_Block_Specification (Block_Conf, Block_Spec);
when others =>