@@ -1275,7 +1275,6 @@ package body Tree_Walk is
1275
1275
UI_Image (Enumeration_Rep (Member));
1276
1276
Val_Name : constant String := Unique_Name (Member);
1277
1277
Base_Name : constant String := Get_Name_String (Chars (Member));
1278
- Member_Symbol : Symbol;
1279
1278
Member_Symbol_Init : constant Irep := New_Irep (I_Constant_Expr);
1280
1279
Typecast_Expr : constant Irep := New_Irep (I_Op_Typecast);
1281
1280
Member_Size : constant Int := UI_To_Int (Esize (Etype (Member)));
@@ -1284,22 +1283,18 @@ package body Tree_Walk is
1284
1283
Set_Identifier (Element, Val_Name);
1285
1284
Set_Basename (Element, Base_Name);
1286
1285
Append_Member (Enum_Body, Element);
1287
- Member_Symbol.Name := Intern (Val_Name);
1288
- Member_Symbol.PrettyName := Intern (Base_Name);
1289
- Member_Symbol.BaseName := Intern (Base_Name);
1290
- Member_Symbol.Mode := Intern (" C" );
1291
- Member_Symbol.IsStaticLifetime := True;
1292
- Member_Symbol.IsStateVar := True;
1293
- Member_Symbol.SymType := Enum_Type_Symbol;
1294
1286
Set_Type (Member_Symbol_Init,
1295
1287
Make_Int_Type (Integer (Member_Size)));
1296
1288
Set_Value (Member_Symbol_Init,
1297
1289
Convert_Uint_To_Hex (Enumeration_Rep (Member),
1298
1290
Member_Size));
1299
1291
Set_Op0 (Typecast_Expr, Member_Symbol_Init);
1300
1292
Set_Type (Typecast_Expr, Enum_Type_Symbol);
1301
- Member_Symbol.Value := Typecast_Expr;
1302
- Global_Symbol_Table.Insert (Member_Symbol.Name, Member_Symbol);
1293
+ New_Enum_Member_Symbol_Entry (Member_Name => Intern (Val_Name),
1294
+ Base_Name => Intern (Base_Name),
1295
+ Enum_Type => Enum_Type_Symbol,
1296
+ Value_Expr => Typecast_Expr,
1297
+ A_Symbol_Table => Global_Symbol_Table);
1303
1298
end ;
1304
1299
Next (Member);
1305
1300
exit when not Present (Member);
@@ -2633,25 +2628,6 @@ package body Tree_Walk is
2633
2628
-- declaration has the pragma Import applied.
2634
2629
Full_View_Entity : constant Entity_Id := Full_View (Entity);
2635
2630
2636
- procedure Register_Constant_In_Symbol_Table (N : Node_Id);
2637
- -- Adds a dummy entry to the symbol table to register that a
2638
- -- constant has already been processed.
2639
-
2640
- procedure Register_Constant_In_Symbol_Table (N : Node_Id) is
2641
- Constant_Name : constant Symbol_Id :=
2642
- Intern (Unique_Name (Defining_Identifier (N)));
2643
- Constant_Symbol : Symbol;
2644
- begin
2645
- Constant_Symbol.Name := Constant_Name;
2646
- Constant_Symbol.BaseName := Constant_Name;
2647
- Constant_Symbol.PrettyName := Constant_Name;
2648
- Constant_Symbol.SymType := Make_Nil (Sloc (N));
2649
- Constant_Symbol.Mode := Intern (" C" );
2650
- Constant_Symbol.Value := Make_Nil (Sloc (N));
2651
- Global_Symbol_Table.Insert (Constant_Name, Constant_Symbol);
2652
-
2653
- end Register_Constant_In_Symbol_Table ;
2654
-
2655
2631
begin
2656
2632
if not Has_Init_Expression (N) and then
2657
2633
Present (Full_View_Entity)
@@ -2664,7 +2640,12 @@ package body Tree_Walk is
2664
2640
-- register it in the symbol table so that it is not
2665
2641
-- processed again when the completion is encountered in
2666
2642
-- the tree.
2667
- Register_Constant_In_Symbol_Table (N);
2643
+ New_Valueless_Object_Symbol_Entry (Intern (Unique_Name
2644
+ (Defining_Identifier (N))),
2645
+ Global_Symbol_Table);
2646
+ -- Adds a dummy entry to the symbol table to register that a
2647
+ -- constant has already been processed.
2648
+
2668
2649
Do_Object_Declaration_Full
2669
2650
(Declaration_Node (Full_View_Entity), Block);
2670
2651
else
@@ -2675,6 +2656,7 @@ package body Tree_Walk is
2675
2656
end ;
2676
2657
end if ;
2677
2658
2659
+ pragma Assert (Global_Symbol_Table.Contains (Obj_Id));
2678
2660
end Do_Object_Declaration ;
2679
2661
2680
2662
-- ------------------------------------------
@@ -2688,6 +2670,9 @@ package body Tree_Walk is
2688
2670
Decl : constant Irep := New_Irep (I_Code_Decl);
2689
2671
Init_Expr : Irep := Ireps.Empty;
2690
2672
2673
+ Obj_Id : constant Symbol_Id := Intern (Unique_Name (Defined));
2674
+ Obj_Type : constant Irep := Get_Type (Id);
2675
+
2691
2676
function Has_Defaulted_Components (E : Entity_Id) return Boolean;
2692
2677
function Needs_Default_Initialisation (E : Entity_Id) return Boolean;
2693
2678
function Disc_Expr (N : Node_Id) return Node_Id;
@@ -2941,9 +2926,6 @@ package body Tree_Walk is
2941
2926
end Make_Default_Initialiser ;
2942
2927
2943
2928
-- Begin processing for Do_Object_Declaration_Full_Declaration
2944
-
2945
- Is_In_Symtab : constant Boolean :=
2946
- Global_Symbol_Table.Contains (Intern (Get_Identifier (Id)));
2947
2929
begin
2948
2930
Set_Source_Location (Decl, (Sloc (N)));
2949
2931
Set_Symbol (Decl, Id);
@@ -2964,14 +2946,22 @@ package body Tree_Walk is
2964
2946
end ;
2965
2947
end if ;
2966
2948
2949
+ if not Global_Symbol_Table.Contains (Obj_Id)
2950
+ then
2951
+ New_Object_Symbol_Entry (Object_Name => Obj_Id,
2952
+ Object_Type => Obj_Type,
2953
+ Object_Init_Value => Init_Expr,
2954
+ A_Symbol_Table => Global_Symbol_Table);
2955
+ end if ;
2956
+
2967
2957
if Init_Expr /= Ireps.Empty then
2968
2958
Append_Op (Block, Make_Code_Assign (Lhs => Id,
2969
2959
Rhs => Typecast_If_Necessary (Init_Expr, Get_Type (Id),
2970
2960
Global_Symbol_Table),
2971
2961
Source_Location => Sloc (N)));
2972
2962
end if ;
2973
2963
2974
- if not Is_In_Symtab then
2964
+ if not Global_Symbol_Table.Contains (Intern (Get_Identifier (Id))) then
2975
2965
Register_Identifier_In_Symbol_Table
2976
2966
(Id, Init_Expr, Global_Symbol_Table);
2977
2967
end if ;
@@ -4155,7 +4145,6 @@ package body Tree_Walk is
4155
4145
Unique_Name (Defining_Identifier (Param_Iter));
4156
4146
4157
4147
Param_Irep : constant Irep := New_Irep (I_Code_Parameter);
4158
- Param_Symbol : Symbol;
4159
4148
begin
4160
4149
if not (Nkind (Parameter_Type (Param_Iter)) in N_Has_Etype) then
4161
4150
Report_Unhandled_Node_Empty (N, " Do_Subprogram_Specification" ,
@@ -4174,15 +4163,10 @@ package body Tree_Walk is
4174
4163
Set_Base_Name (Param_Irep, Param_Name);
4175
4164
Append_Parameter (Param_List, Param_Irep);
4176
4165
-- Add the param to the symtab as well:
4177
- Param_Symbol.Name := Intern (Param_Name);
4178
- Param_Symbol.PrettyName := Param_Symbol.Name;
4179
- Param_Symbol.BaseName := Param_Symbol.Name;
4180
- Param_Symbol.SymType := Param_Type;
4181
- Param_Symbol.IsThreadLocal := True;
4182
- Param_Symbol.IsFileLocal := True;
4183
- Param_Symbol.IsLValue := True;
4184
- Param_Symbol.IsParameter := True;
4185
- Global_Symbol_Table.Insert (Param_Symbol.Name, Param_Symbol);
4166
+ New_Parameter_Symbol_Entry (Name_Id => Intern (Param_Name),
4167
+ BaseName => Param_Name,
4168
+ Symbol_Type => Param_Type,
4169
+ A_Symbol_Table => Global_Symbol_Table);
4186
4170
Next (Param_Iter);
4187
4171
end ;
4188
4172
end loop ;
@@ -4424,17 +4408,12 @@ package body Tree_Walk is
4424
4408
Number_Str : constant String :=
4425
4409
Number_Str_Raw (2 .. Number_Str_Raw'Last);
4426
4410
Fresh_Name : constant String := " __anonymous_type_" & Number_Str;
4427
- Type_Symbol : Symbol;
4428
4411
begin
4429
4412
Anonymous_Type_Counter := Anonymous_Type_Counter + 1 ;
4430
4413
4431
- Type_Symbol.SymType := Actual_Type;
4432
- Type_Symbol.IsType := True;
4433
- Type_Symbol.Name := Intern (Fresh_Name);
4434
- Type_Symbol.PrettyName := Intern (Fresh_Name);
4435
- Type_Symbol.BaseName := Intern (Fresh_Name);
4436
- Type_Symbol.Mode := Intern (" C" );
4437
- Global_Symbol_Table.Insert (Intern (Fresh_Name), Type_Symbol);
4414
+ New_Type_Symbol_Entry (Type_Name => Intern (Fresh_Name),
4415
+ Type_Of_Type => Actual_Type,
4416
+ A_Symbol_Table => Global_Symbol_Table);
4438
4417
4439
4418
Set_Identifier (Ret, Fresh_Name);
4440
4419
@@ -4510,6 +4489,7 @@ package body Tree_Walk is
4510
4489
-- Create the check function on demand:
4511
4490
declare
4512
4491
Fn_Symbol : Symbol;
4492
+ Fn_Name : constant String := " __ada_runtime_check" ;
4513
4493
Assertion : constant Irep := New_Irep (I_Code_Assert);
4514
4494
Formal_Params : constant Irep := New_Irep (I_Parameter_List);
4515
4495
Formal_Param : constant Irep := New_Irep (I_Code_Parameter);
@@ -4527,15 +4507,14 @@ package body Tree_Walk is
4527
4507
Set_Return_Type (Fn_Type, Void_Type);
4528
4508
Set_Assertion (Assertion, Formal_Expr);
4529
4509
4530
- Fn_Symbol.Name := Intern (" __ada_runtime_check" );
4531
- Fn_Symbol.PrettyName := Fn_Symbol.Name;
4532
- Fn_Symbol.BaseName := Fn_Symbol.Name;
4533
- Fn_Symbol.Value := Assertion;
4534
- Fn_Symbol.SymType := Fn_Type;
4535
- Global_Symbol_Table.Insert (Fn_Symbol.Name, Fn_Symbol);
4510
+ Fn_Symbol :=
4511
+ New_Function_Symbol_Entry (Name => Fn_Name,
4512
+ Symbol_Type => Fn_Type,
4513
+ Value => Assertion,
4514
+ A_Symbol_Table => Global_Symbol_Table);
4536
4515
4537
4516
Check_Function_Symbol := New_Irep (I_Symbol_Expr);
4538
- Set_Identifier (Check_Function_Symbol, Unintern (Fn_Symbol.Name) );
4517
+ Set_Identifier (Check_Function_Symbol, Fn_Name );
4539
4518
Set_Type (Check_Function_Symbol, Fn_Symbol.SymType);
4540
4519
end ;
4541
4520
end if ;
@@ -5303,18 +5282,10 @@ package body Tree_Walk is
5303
5282
Do_Subprogram_Specification (N);
5304
5283
Subprog_Name : constant Symbol_Id :=
5305
5284
Intern (Unique_Name (Defining_Unit_Name (N)));
5306
-
5307
- Subprog_Symbol : Symbol;
5308
-
5309
5285
begin
5310
- Subprog_Symbol.Name := Subprog_Name;
5311
- Subprog_Symbol.BaseName := Subprog_Name;
5312
- Subprog_Symbol.PrettyName := Subprog_Name;
5313
- Subprog_Symbol.SymType := Subprog_Type;
5314
- Subprog_Symbol.Mode := Intern (" C" );
5315
- Subprog_Symbol.Value := Make_Nil (Sloc (N));
5316
-
5317
- Global_Symbol_Table.Insert (Subprog_Name, Subprog_Symbol);
5286
+ New_Subprogram_Symbol_Entry (Subprog_Name => Subprog_Name,
5287
+ Subprog_Type => Subprog_Type,
5288
+ A_Symbol_Table => Global_Symbol_Table);
5318
5289
end Register_Subprogram_Specification ;
5319
5290
5320
5291
-- -----------------------------
0 commit comments