From 221bd46f4dd1bcb3496c7e6a9c728ed33b9616dd Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 14 Jan 2015 03:50:46 +0100 Subject: xrefs: adjust for vhdl08. --- src/vhdl/parse.adb | 23 +++++++++++++++++++---- src/vhdl/sem.adb | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 5430e0519..fef73472e 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 138056896..608bfc88d 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 => -- cgit v1.2.3