aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/elocations.adb4
-rw-r--r--src/vhdl/elocations.ads8
-rw-r--r--src/vhdl/elocations_meta.adb2
-rw-r--r--src/vhdl/iirs.ads2
-rw-r--r--src/vhdl/parse.adb80
5 files changed, 56 insertions, 40 deletions
diff --git a/src/vhdl/elocations.adb b/src/vhdl/elocations.adb
index d964bcde0..13ed06fa6 100644
--- a/src/vhdl/elocations.adb
+++ b/src/vhdl/elocations.adb
@@ -201,7 +201,6 @@ package body Elocations is
| Iir_Kind_Array_Element_Resolution
| Iir_Kind_Record_Resolution
| Iir_Kind_Record_Element_Resolution
- | Iir_Kind_Attribute_Specification
| Iir_Kind_Disconnection_Specification
| Iir_Kind_Configuration_Specification
| Iir_Kind_Access_Type_Definition
@@ -230,6 +229,7 @@ package body Elocations is
| Iir_Kind_Unit_Declaration
| Iir_Kind_Library_Declaration
| Iir_Kind_Element_Declaration
+ | Iir_Kind_Non_Object_Alias_Declaration
| Iir_Kind_Psl_Declaration
| Iir_Kind_Psl_Endpoint_Declaration
| Iir_Kind_Terminal_Declaration
@@ -373,11 +373,11 @@ package body Elocations is
| Iir_Kind_Attribute_Name =>
return Format_None;
when Iir_Kind_Library_Clause
+ | Iir_Kind_Attribute_Specification
| Iir_Kind_Anonymous_Type_Declaration
| Iir_Kind_Attribute_Declaration
| Iir_Kind_Group_Template_Declaration
| Iir_Kind_Group_Declaration
- | Iir_Kind_Non_Object_Alias_Declaration
| Iir_Kind_Function_Declaration
| Iir_Kind_Procedure_Declaration
| Iir_Kind_Object_Alias_Declaration
diff --git a/src/vhdl/elocations.ads b/src/vhdl/elocations.ads
index 57c044b52..4a83820e3 100644
--- a/src/vhdl/elocations.ads
+++ b/src/vhdl/elocations.ads
@@ -98,7 +98,9 @@ package Elocations is
-- Iir_Kind_Entity_Class (None)
- -- Iir_Kind_Attribute_Specification (None)
+ -- Iir_Kind_Attribute_Specification (L1)
+ --
+ -- Get/Set_Start_Location (Field1)
-- Iir_Kind_Attribute_Value (None)
@@ -185,9 +187,7 @@ package Elocations is
--
-- Get/Set_Start_Location (Field1)
- -- Iir_Kind_Non_Object_Alias_Declaration (L1)
- --
- -- Get/Set_Start_Location (Field1)
+ -- Iir_Kind_Non_Object_Alias_Declaration (None)
-- Iir_Kind_Anonymous_Type_Declaration (L1)
--
diff --git a/src/vhdl/elocations_meta.adb b/src/vhdl/elocations_meta.adb
index 9ead9dafa..c3013392a 100644
--- a/src/vhdl/elocations_meta.adb
+++ b/src/vhdl/elocations_meta.adb
@@ -132,6 +132,7 @@ package body Elocations_Meta is
begin
case K is
when Iir_Kind_Library_Clause
+ | Iir_Kind_Attribute_Specification
| Iir_Kind_Protected_Type_Declaration
| Iir_Kind_Record_Type_Definition
| Iir_Kind_Protected_Type_Body
@@ -149,7 +150,6 @@ package body Elocations_Meta is
| Iir_Kind_Attribute_Declaration
| Iir_Kind_Group_Template_Declaration
| Iir_Kind_Group_Declaration
- | Iir_Kind_Non_Object_Alias_Declaration
| Iir_Kind_Function_Declaration
| Iir_Kind_Procedure_Declaration
| Iir_Kind_Function_Body
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 3ea46ebc0..47818a547 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -642,6 +642,8 @@ package Iirs is
-- | OTHERS
-- | ALL
--
+ -- The location points to 'for'.
+ --
-- The declaration containing this type declaration.
-- Get/Set_Parent (Field0)
--
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 493736f12..bb20c3644 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -3535,8 +3535,10 @@ package body Parse is
is
Res: Iir;
Ident : Name_Id;
+ Start_Loc : Location_Type;
begin
-- Skip 'alias'.
+ Start_Loc := Get_Token_Location;
Scan;
Res := Create_Iir (Iir_Kind_Object_Alias_Declaration);
@@ -3560,6 +3562,7 @@ package body Parse is
Scan;
if Current_Token = Tok_Colon then
+ -- Skip ':'.
Scan;
Set_Subtype_Indication (Res, Parse_Subtype_Indication);
end if;
@@ -3569,6 +3572,11 @@ package body Parse is
Scan;
Set_Name (Res, Parse_Name);
+ if Flag_Elocations then
+ Create_Elocations (Res);
+ Set_Start_Location (Res, Start_Loc);
+ end if;
+
return Res;
end Parse_Alias_Declaration;
@@ -3585,8 +3593,11 @@ package body Parse is
begin
Res := Create_Iir (Iir_Kind_Configuration_Specification);
Set_Location (Res);
+
+ -- Eat 'for'.
Expect (Tok_For);
Scan;
+
Parse_Component_Specification (Res);
Set_Binding_Indication (Res, Parse_Binding_Indication);
Expect (Tok_Semi_Colon);
@@ -3735,11 +3746,17 @@ package body Parse is
--
function Parse_Attribute return Iir
is
- Loc : Location_Type;
Ident : Name_Id;
+ Res : Iir;
+ Designator : Iir;
+ Loc, Start_Loc : Location_Type;
begin
Expect (Tok_Attribute);
+
+ -- Eat 'attribute'.
+ Start_Loc := Get_Token_Location;
Scan_Expect (Tok_Identifier);
+
Loc := Get_Token_Location;
Ident := Current_Identifier;
@@ -3748,50 +3765,47 @@ package body Parse is
case Current_Token is
when Tok_Colon =>
- declare
- Res : Iir_Attribute_Declaration;
- begin
- Res := Create_Iir (Iir_Kind_Attribute_Declaration);
- Set_Location (Res, Loc);
- Set_Identifier (Res, Ident);
+ Res := Create_Iir (Iir_Kind_Attribute_Declaration);
+ Set_Location (Res, Loc);
+ Set_Identifier (Res, Ident);
- -- Skip ':'.
- Scan;
+ -- Skip ':'.
+ Scan;
- Set_Type_Mark (Res, Parse_Type_Mark (Check_Paren => True));
- Expect (Tok_Semi_Colon);
- return Res;
- end;
+ Set_Type_Mark (Res, Parse_Type_Mark (Check_Paren => True));
+ Expect (Tok_Semi_Colon);
when Tok_Of =>
- declare
- Res : Iir_Attribute_Specification;
- Designator : Iir_Simple_Name;
- begin
- Res := Create_Iir (Iir_Kind_Attribute_Specification);
- Set_Location (Res, Loc);
- Designator := Create_Iir (Iir_Kind_Simple_Name);
- Set_Location (Designator, Loc);
- Set_Identifier (Designator, Ident);
- Set_Attribute_Designator (Res, Designator);
+ Res := Create_Iir (Iir_Kind_Attribute_Specification);
+ Set_Location (Res, Loc);
+ Designator := Create_Iir (Iir_Kind_Simple_Name);
+ Set_Location (Designator, Loc);
+ Set_Identifier (Designator, Ident);
+ Set_Attribute_Designator (Res, Designator);
- -- Skip 'of'.
- Scan;
+ -- Skip 'of'.
+ Scan;
- Parse_Entity_Name_List (Res);
- Expect (Tok_Is);
+ Parse_Entity_Name_List (Res);
+ Expect (Tok_Is);
- -- Skip 'is'.
- Scan;
+ -- Skip 'is'.
+ Scan;
+
+ Set_Expression (Res, Parse_Expression);
+ Expect (Tok_Semi_Colon);
- Set_Expression (Res, Parse_Expression);
- Expect (Tok_Semi_Colon);
- return Res;
- end;
when others =>
Error_Msg_Parse ("':' or 'of' expected after identifier");
return Null_Iir;
end case;
+
+ if Flag_Elocations then
+ Create_Elocations (Res);
+ Set_Start_Location (Res, Start_Loc);
+ end if;
+
+ return Res;
end Parse_Attribute;
-- precond : GROUP