summaryrefslogtreecommitdiff
path: root/src/vhdl/sem_decls.adb
diff options
context:
space:
mode:
authorTristan Gingold2015-08-29 07:57:12 +0200
committerTristan Gingold2015-08-29 07:57:12 +0200
commitb75d703676ab830ea3e5731e1965d1d89879a456 (patch)
tree1a0a21ba1cce6385715bd2823853ee4ad47905ee /src/vhdl/sem_decls.adb
parent64fa65e1395bef4f05c51bc19d9a46d6003339ee (diff)
downloadghdl-b75d703676ab830ea3e5731e1965d1d89879a456.tar.gz
ghdl-b75d703676ab830ea3e5731e1965d1d89879a456.tar.bz2
ghdl-b75d703676ab830ea3e5731e1965d1d89879a456.zip
Replace fat accesses by bounds accesses
translate: separate info for signals from object. Improve some error messages.
Diffstat (limited to 'src/vhdl/sem_decls.adb')
-rw-r--r--src/vhdl/sem_decls.adb26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index 5081fa3..a2475c4 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -2491,7 +2491,8 @@ package body Sem_Decls is
end if;
Set_Named_Entity (Name, N_Entity);
- Set_Name (Alias, Finish_Sem_Name (Name));
+ Name := Finish_Sem_Name (Name);
+ Set_Name (Alias, Name);
if Is_Object_Name (N_Entity) then
-- Object alias declaration.
@@ -2507,10 +2508,6 @@ package body Sem_Decls is
else
-- Non object alias declaration.
- if Get_Type (Alias) /= Null_Iir then
- Error_Msg_Sem
- ("subtype indication not allowed for non-object alias", Alias);
- end if;
if Get_Subtype_Indication (Alias) /= Null_Iir then
Error_Msg_Sem
("subtype indication shall not appear in a nonobject alias",
@@ -2522,7 +2519,7 @@ package body Sem_Decls is
Set_Parent (Res, Get_Parent (Alias));
Set_Chain (Res, Get_Chain (Alias));
Set_Identifier (Res, Get_Identifier (Alias));
- Set_Name (Res, Name);
+ Set_Name (Res, Get_Name (Alias));
Set_Alias_Signature (Res, Sig);
Sem_Scopes.Add_Name (Res);
@@ -2530,7 +2527,22 @@ package body Sem_Decls is
Free_Iir (Alias);
- Sem_Non_Object_Alias_Declaration (Res);
+ if Get_Kind (Name) in Iir_Kinds_Denoting_Name then
+ Sem_Non_Object_Alias_Declaration (Res);
+ else
+ Error_Msg_Sem
+ ("name of nonobject alias is not a declaration", Name);
+
+ -- Create a simple name to an error node.
+ N_Entity := Create_Error (Name);
+ Name := Create_Iir (Iir_Kind_Simple_Name);
+ Location_Copy (Name, N_Entity);
+ Set_Identifier (Name, Get_Identifier (Res)); -- Better idea ?
+ Set_Named_Entity (Name, N_Entity);
+ Set_Base_Name (Name, Name);
+ Set_Name (Res, Name);
+ end if;
+
return Res;
end if;
end Sem_Alias_Declaration;