Skip to content

Commit ea55211

Browse files
committed
Extract new type entry
and create a wrapper for it.
1 parent 732eec8 commit ea55211

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

gnat2goto/driver/goto_utils.adb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ package body GOTO_Utils is
121121
return Ret;
122122
end Symbol_Expr;
123123

124+
procedure New_Type_Symbol_Entry (Type_Name : Symbol_Id; Type_Of_Type : Irep;
125+
A_Symbol_Table : in out Symbol_Table) is
126+
Type_Symbol : Symbol;
127+
begin
128+
Type_Symbol.SymType := Type_Of_Type;
129+
Type_Symbol.IsType := True;
130+
Type_Symbol.Name := Type_Name;
131+
Type_Symbol.PrettyName := Type_Name;
132+
Type_Symbol.BaseName := Type_Name;
133+
Type_Symbol.Mode := Intern ("C");
134+
135+
A_Symbol_Table.Insert (Type_Name, Type_Symbol);
136+
end New_Type_Symbol_Entry;
137+
124138
procedure New_Valueless_Object_Symbol_Entry (Constant_Name : Symbol_Id;
125139
A_Symbol_Table : in out Symbol_Table)
126140
is

gnat2goto/driver/goto_utils.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ package GOTO_Utils is
4141
function Symbol_Expr (Sym : Symbol) return Irep
4242
with Post => Kind (Symbol_Expr'Result) = I_Symbol_Expr;
4343

44+
procedure New_Type_Symbol_Entry (Type_Name : Symbol_Id; Type_Of_Type : Irep;
45+
A_Symbol_Table : in out Symbol_Table)
46+
with Pre => Kind (Type_Of_Type) in Class_Type;
47+
4448
procedure New_Valueless_Object_Symbol_Entry (Constant_Name : Symbol_Id;
4549
A_Symbol_Table : in out Symbol_Table);
4650

gnat2goto/driver/tree_walk.adb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4406,17 +4406,12 @@ package body Tree_Walk is
44064406
Number_Str : constant String :=
44074407
Number_Str_Raw (2 .. Number_Str_Raw'Last);
44084408
Fresh_Name : constant String := "__anonymous_type_" & Number_Str;
4409-
Type_Symbol : Symbol;
44104409
begin
44114410
Anonymous_Type_Counter := Anonymous_Type_Counter + 1;
44124411

4413-
Type_Symbol.SymType := Actual_Type;
4414-
Type_Symbol.IsType := True;
4415-
Type_Symbol.Name := Intern (Fresh_Name);
4416-
Type_Symbol.PrettyName := Intern (Fresh_Name);
4417-
Type_Symbol.BaseName := Intern (Fresh_Name);
4418-
Type_Symbol.Mode := Intern ("C");
4419-
Global_Symbol_Table.Insert (Intern (Fresh_Name), Type_Symbol);
4412+
New_Type_Symbol_Entry (Type_Name => Intern (Fresh_Name),
4413+
Type_Of_Type => Actual_Type,
4414+
A_Symbol_Table => Global_Symbol_Table);
44204415

44214416
Set_Identifier (Ret, Fresh_Name);
44224417

0 commit comments

Comments
 (0)