@@ -1275,7 +1275,6 @@ package body Tree_Walk is
12751275 UI_Image (Enumeration_Rep (Member));
12761276 Val_Name : constant String := Unique_Name (Member);
12771277 Base_Name : constant String := Get_Name_String (Chars (Member));
1278- Member_Symbol : Symbol;
12791278 Member_Symbol_Init : constant Irep := New_Irep (I_Constant_Expr);
12801279 Typecast_Expr : constant Irep := New_Irep (I_Op_Typecast);
12811280 Member_Size : constant Int := UI_To_Int (Esize (Etype (Member)));
@@ -1284,22 +1283,18 @@ package body Tree_Walk is
12841283 Set_Identifier (Element, Val_Name);
12851284 Set_Basename (Element, Base_Name);
12861285 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;
12941286 Set_Type (Member_Symbol_Init,
12951287 Make_Int_Type (Integer (Member_Size)));
12961288 Set_Value (Member_Symbol_Init,
12971289 Convert_Uint_To_Hex (Enumeration_Rep (Member),
12981290 Member_Size));
12991291 Set_Op0 (Typecast_Expr, Member_Symbol_Init);
13001292 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);
13031298 end ;
13041299 Next (Member);
13051300 exit when not Present (Member);
@@ -2633,25 +2628,6 @@ package body Tree_Walk is
26332628 -- declaration has the pragma Import applied.
26342629 Full_View_Entity : constant Entity_Id := Full_View (Entity);
26352630
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-
26552631 begin
26562632 if not Has_Init_Expression (N) and then
26572633 Present (Full_View_Entity)
@@ -2664,7 +2640,12 @@ package body Tree_Walk is
26642640 -- register it in the symbol table so that it is not
26652641 -- processed again when the completion is encountered in
26662642 -- 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+
26682649 Do_Object_Declaration_Full
26692650 (Declaration_Node (Full_View_Entity), Block);
26702651 else
@@ -2675,6 +2656,7 @@ package body Tree_Walk is
26752656 end ;
26762657 end if ;
26772658
2659+ pragma Assert (Global_Symbol_Table.Contains (Obj_Id));
26782660 end Do_Object_Declaration ;
26792661
26802662 -- ------------------------------------------
@@ -2688,6 +2670,9 @@ package body Tree_Walk is
26882670 Decl : constant Irep := New_Irep (I_Code_Decl);
26892671 Init_Expr : Irep := Ireps.Empty;
26902672
2673+ Obj_Id : constant Symbol_Id := Intern (Unique_Name (Defined));
2674+ Obj_Type : constant Irep := Get_Type (Id);
2675+
26912676 function Has_Defaulted_Components (E : Entity_Id) return Boolean;
26922677 function Needs_Default_Initialisation (E : Entity_Id) return Boolean;
26932678 function Disc_Expr (N : Node_Id) return Node_Id;
@@ -2941,9 +2926,6 @@ package body Tree_Walk is
29412926 end Make_Default_Initialiser ;
29422927
29432928 -- Begin processing for Do_Object_Declaration_Full_Declaration
2944-
2945- Is_In_Symtab : constant Boolean :=
2946- Global_Symbol_Table.Contains (Intern (Get_Identifier (Id)));
29472929 begin
29482930 Set_Source_Location (Decl, (Sloc (N)));
29492931 Set_Symbol (Decl, Id);
@@ -2964,14 +2946,22 @@ package body Tree_Walk is
29642946 end ;
29652947 end if ;
29662948
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+
29672957 if Init_Expr /= Ireps.Empty then
29682958 Append_Op (Block, Make_Code_Assign (Lhs => Id,
29692959 Rhs => Typecast_If_Necessary (Init_Expr, Get_Type (Id),
29702960 Global_Symbol_Table),
29712961 Source_Location => Sloc (N)));
29722962 end if ;
29732963
2974- if not Is_In_Symtab then
2964+ if not Global_Symbol_Table.Contains (Intern (Get_Identifier (Id))) then
29752965 Register_Identifier_In_Symbol_Table
29762966 (Id, Init_Expr, Global_Symbol_Table);
29772967 end if ;
@@ -4155,7 +4145,6 @@ package body Tree_Walk is
41554145 Unique_Name (Defining_Identifier (Param_Iter));
41564146
41574147 Param_Irep : constant Irep := New_Irep (I_Code_Parameter);
4158- Param_Symbol : Symbol;
41594148 begin
41604149 if not (Nkind (Parameter_Type (Param_Iter)) in N_Has_Etype) then
41614150 Report_Unhandled_Node_Empty (N, " Do_Subprogram_Specification" ,
@@ -4174,15 +4163,10 @@ package body Tree_Walk is
41744163 Set_Base_Name (Param_Irep, Param_Name);
41754164 Append_Parameter (Param_List, Param_Irep);
41764165 -- 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);
41864170 Next (Param_Iter);
41874171 end ;
41884172 end loop ;
@@ -4424,17 +4408,12 @@ package body Tree_Walk is
44244408 Number_Str : constant String :=
44254409 Number_Str_Raw (2 .. Number_Str_Raw'Last);
44264410 Fresh_Name : constant String := " __anonymous_type_" & Number_Str;
4427- Type_Symbol : Symbol;
44284411 begin
44294412 Anonymous_Type_Counter := Anonymous_Type_Counter + 1 ;
44304413
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);
44384417
44394418 Set_Identifier (Ret, Fresh_Name);
44404419
@@ -4510,6 +4489,7 @@ package body Tree_Walk is
45104489 -- Create the check function on demand:
45114490 declare
45124491 Fn_Symbol : Symbol;
4492+ Fn_Name : constant String := " __ada_runtime_check" ;
45134493 Assertion : constant Irep := New_Irep (I_Code_Assert);
45144494 Formal_Params : constant Irep := New_Irep (I_Parameter_List);
45154495 Formal_Param : constant Irep := New_Irep (I_Code_Parameter);
@@ -4527,15 +4507,14 @@ package body Tree_Walk is
45274507 Set_Return_Type (Fn_Type, Void_Type);
45284508 Set_Assertion (Assertion, Formal_Expr);
45294509
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);
45364515
45374516 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 );
45394518 Set_Type (Check_Function_Symbol, Fn_Symbol.SymType);
45404519 end ;
45414520 end if ;
@@ -5303,18 +5282,10 @@ package body Tree_Walk is
53035282 Do_Subprogram_Specification (N);
53045283 Subprog_Name : constant Symbol_Id :=
53055284 Intern (Unique_Name (Defining_Unit_Name (N)));
5306-
5307- Subprog_Symbol : Symbol;
5308-
53095285 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);
53185289 end Register_Subprogram_Specification ;
53195290
53205291 -- -----------------------------
0 commit comments