aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-01-18 20:42:56 +0100
committerTristan Gingold <tgingold@free.fr>2018-01-20 07:40:52 +0100
commitab7f46db88ef03564436f1bf96339c9ed3452787 (patch)
treede4e599f2fb655aabdad3ed1bcd84c6d5ef6b520 /src/vhdl/translate
parenta883fc4125afc3e874dfa1e4a5817c01219e0db9 (diff)
downloadghdl-ab7f46db88ef03564436f1bf96339c9ed3452787.tar.gz
ghdl-ab7f46db88ef03564436f1bf96339c9ed3452787.tar.bz2
ghdl-ab7f46db88ef03564436f1bf96339c9ed3452787.zip
translate: remove other use of Nam_Buffer.
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r--src/vhdl/translate/trans-chap7.adb9
-rw-r--r--src/vhdl/translate/trans-helpers2.adb9
-rw-r--r--src/vhdl/translate/trans-rtis.adb20
3 files changed, 13 insertions, 25 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 79b013f9a..385dbed57 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -419,8 +419,7 @@ package body Trans.Chap7 is
function Translate_Static_String (Str_Type : Iir; Str_Ident : Name_Id)
return O_Cnode
is
- use Name_Table;
-
+ Img : constant String := Name_Table.Image (Str_Ident);
Literal_List : constant Iir_Flist :=
Get_Enumeration_Literal_List (Character_Type_Definition);
Lit : Iir;
@@ -431,10 +430,8 @@ package body Trans.Chap7 is
Start_Array_Aggr (List, Get_Ortho_Type (Str_Type, Mode_Value));
- Image (Str_Ident);
- for I in 1 .. Nam_Length loop
- Lit := Get_Nth_Element (Literal_List,
- Character'Pos (Nam_Buffer (I)));
+ for I in Img'Range loop
+ Lit := Get_Nth_Element (Literal_List, Character'Pos (Img (I)));
New_Array_Aggr_El (List, Get_Ortho_Expr (Lit));
end loop;
diff --git a/src/vhdl/translate/trans-helpers2.adb b/src/vhdl/translate/trans-helpers2.adb
index bcbb1f907..b0cc37d58 100644
--- a/src/vhdl/translate/trans-helpers2.adb
+++ b/src/vhdl/translate/trans-helpers2.adb
@@ -88,15 +88,12 @@ package body Trans.Helpers2 is
end Create_String;
function Create_String (Str : Name_Id; Id : O_Ident; Storage : O_Storage)
- return O_Dnode
+ return O_Dnode
is
use Name_Table;
begin
- if Name_Table.Is_Character (Str) then
- raise Internal_Error;
- end if;
- Image (Str);
- return Create_String (Nam_Buffer (1 .. Nam_Length), Id, Storage);
+ pragma Assert (not Name_Table.Is_Character (Str));
+ return Create_String (Image (Str), Id, Storage);
end Create_String;
function Create_String_Len (Str : String; Id : O_Ident) return O_Cnode
diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb
index 3258ce085..268c4fb9d 100644
--- a/src/vhdl/translate/trans-rtis.adb
+++ b/src/vhdl/translate/trans-rtis.adb
@@ -986,19 +986,15 @@ package body Trans.Rtis is
function Generate_Name (Node : Iir) return O_Dnode
is
use Name_Table;
- Id : Name_Id;
+ Node_Id : constant Name_Id := Get_Identifier (Node);
+ Id : O_Ident;
begin
- Id := Get_Identifier (Node);
- if Is_Character (Id) then
- Nam_Buffer (1) := ''';
- Nam_Buffer (2) := Get_Character (Id);
- Nam_Buffer (3) := ''';
- Nam_Length := 3;
+ Id := Create_Identifier ("RTISTR");
+ if Is_Character (Node_Id) then
+ return Create_String (''' & Get_Character (Node_Id) & ''', Id);
else
- Image (Id);
+ return Create_String (Image (Node_Id), Id);
end if;
- return Create_String (Nam_Buffer (1 .. Nam_Length),
- Create_Identifier ("RTISTR"));
end Generate_Name;
function Get_Null_Loc return O_Cnode is
@@ -2823,10 +2819,8 @@ package body Trans.Rtis is
Storage, Ghdl_Rtin_Type_Scalar);
if Public then
- Image (Id);
Name := Create_String
- (Nam_Buffer (1 .. Nam_Length),
- Create_Identifier_Without_Prefix (Id, "__RTISTR"));
+ (Image (Id), Create_Identifier_Without_Prefix (Id, "__RTISTR"));
Start_Init_Value (Info.Library_Rti_Const);
Start_Record_Aggr (Aggr, Ghdl_Rtin_Type_Scalar);
New_Record_Aggr_El (Aggr, Generate_Common (Ghdl_Rtik_Library));