Commit c12beea0 by Robert Dewar Committed by Arnaud Charlet

exp_ch6.adb, [...]: Use Make_Temporary

2010-06-17  Robert Dewar  <dewar@adacore.com>

	* exp_ch6.adb, exp_ch7.adb, exp_ch5.adb: Use Make_Temporary
	* tbuild.ads (Make_Temporary): More comment updates
	* tbuild.adb: Minor reformatting

From-SVN: r160894
parent 191fcb3a
2010-06-17 Robert Dewar <dewar@adacore.com> 2010-06-17 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb, exp_ch7.adb, exp_ch5.adb: Use Make_Temporary
* tbuild.ads (Make_Temporary): More comment updates
* tbuild.adb: Minor reformatting
2010-06-17 Robert Dewar <dewar@adacore.com>
* checks.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch11.adb, * checks.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch11.adb,
exp_ch3.adb, exp_ch4.adb: Minor code reorganization. exp_ch3.adb, exp_ch4.adb: Minor code reorganization.
Use Make_Temporary. Use Make_Temporary.
......
...@@ -516,8 +516,7 @@ package body Exp_Ch5 is ...@@ -516,8 +516,7 @@ package body Exp_Ch5 is
if Nkind (Rhs) = N_String_Literal then if Nkind (Rhs) = N_String_Literal then
declare declare
Temp : constant Entity_Id := Temp : constant Entity_Id := Make_Temporary (Loc, 'T', Rhs);
Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
Decl : Node_Id; Decl : Node_Id;
begin begin
...@@ -1028,13 +1027,8 @@ package body Exp_Ch5 is ...@@ -1028,13 +1027,8 @@ package body Exp_Ch5 is
R_Index := First_Index (R_Type); R_Index := First_Index (R_Type);
for J in 1 .. Ndim loop for J in 1 .. Ndim loop
Lnn (J) := Lnn (J) := Make_Temporary (Loc, 'L');
Make_Defining_Identifier (Loc, Rnn (J) := Make_Temporary (Loc, 'R');
Chars => New_Internal_Name ('L'));
Rnn (J) :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('R'));
L_Index_Type (J) := Etype (L_Index); L_Index_Type (J) := Etype (L_Index);
R_Index_Type (J) := Etype (R_Index); R_Index_Type (J) := Etype (R_Index);
...@@ -1624,8 +1618,7 @@ package body Exp_Ch5 is ...@@ -1624,8 +1618,7 @@ package body Exp_Ch5 is
BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs)); BPAR_Expr : constant Node_Id := Relocate_Node (Prefix (Lhs));
BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr); BPAR_Typ : constant Entity_Id := Etype (BPAR_Expr);
Tnn : constant Entity_Id := Tnn : constant Entity_Id :=
Make_Defining_Identifier (Loc, Make_Temporary (Loc, 'T', BPAR_Expr);
Chars => New_Internal_Name ('T'));
begin begin
-- Insert the post assignment first, because we want to copy the -- Insert the post assignment first, because we want to copy the
...@@ -2848,8 +2841,7 @@ package body Exp_Ch5 is ...@@ -2848,8 +2841,7 @@ package body Exp_Ch5 is
-- Create an access type designating the function's -- Create an access type designating the function's
-- result subtype. -- result subtype.
Ref_Type := Ref_Type := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
Ptr_Type_Decl := Ptr_Type_Decl :=
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
...@@ -2867,9 +2859,7 @@ package body Exp_Ch5 is ...@@ -2867,9 +2859,7 @@ package body Exp_Ch5 is
-- from an implicit access value passed in by the caller -- from an implicit access value passed in by the caller
-- or from the result of an allocator. -- or from the result of an allocator.
Alloc_Obj_Id := Alloc_Obj_Id := Make_Temporary (Loc, 'R');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('R'));
Set_Etype (Alloc_Obj_Id, Ref_Type); Set_Etype (Alloc_Obj_Id, Ref_Type);
Alloc_Obj_Decl := Alloc_Obj_Decl :=
...@@ -3854,8 +3844,7 @@ package body Exp_Ch5 is ...@@ -3854,8 +3844,7 @@ package body Exp_Ch5 is
then then
declare declare
Return_Object_Entity : constant Entity_Id := Return_Object_Entity : constant Entity_Id :=
Make_Defining_Identifier (Loc, Make_Temporary (Loc, 'R', Exp);
New_Internal_Name ('R'));
Obj_Decl : constant Node_Id := Obj_Decl : constant Node_Id :=
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Return_Object_Entity, Defining_Identifier => Return_Object_Entity,
...@@ -4009,13 +3998,9 @@ package body Exp_Ch5 is ...@@ -4009,13 +3998,9 @@ package body Exp_Ch5 is
elsif CW_Or_Has_Controlled_Part (Utyp) then elsif CW_Or_Has_Controlled_Part (Utyp) then
declare declare
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Temp : constant Entity_Id := Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('R'));
Acc_Typ : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('A'));
Alloc_Node : Node_Id; Alloc_Node : Node_Id;
Temp : Entity_Id;
begin begin
Set_Ekind (Acc_Typ, E_Access_Type); Set_Ekind (Acc_Typ, E_Access_Type);
...@@ -4031,13 +4016,15 @@ package body Exp_Ch5 is ...@@ -4031,13 +4016,15 @@ package body Exp_Ch5 is
Expression => Expression =>
Make_Qualified_Expression (Loc, Make_Qualified_Expression (Loc,
Subtype_Mark => New_Reference_To (Etype (Exp), Loc), Subtype_Mark => New_Reference_To (Etype (Exp), Loc),
Expression => Relocate_Node (Exp))); Expression => Relocate_Node (Exp)));
-- We do not want discriminant checks on the declaration, -- We do not want discriminant checks on the declaration,
-- given that it gets its value from the allocator. -- given that it gets its value from the allocator.
Set_No_Initialization (Alloc_Node); Set_No_Initialization (Alloc_Node);
Temp := Make_Temporary (Loc, 'R', Alloc_Node);
Insert_List_Before_And_Analyze (N, New_List ( Insert_List_Before_And_Analyze (N, New_List (
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
Defining_Identifier => Acc_Typ, Defining_Identifier => Acc_Typ,
...@@ -4118,18 +4105,18 @@ package body Exp_Ch5 is ...@@ -4118,18 +4105,18 @@ package body Exp_Ch5 is
else else
declare declare
ExpR : constant Node_Id := Relocate_Node (Exp);
Result_Id : constant Entity_Id := Result_Id : constant Entity_Id :=
Make_Defining_Identifier (Loc, Make_Temporary (Loc, 'R', ExpR);
Chars => New_Internal_Name ('R')); Result_Exp : constant Node_Id :=
Result_Exp : constant Node_Id :=
New_Reference_To (Result_Id, Loc); New_Reference_To (Result_Id, Loc);
Result_Obj : constant Node_Id := Result_Obj : constant Node_Id :=
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Result_Id, Defining_Identifier => Result_Id,
Object_Definition => Object_Definition =>
New_Reference_To (R_Type, Loc), New_Reference_To (R_Type, Loc),
Constant_Present => True, Constant_Present => True,
Expression => Relocate_Node (Exp)); Expression => ExpR);
begin begin
Set_Assignment_OK (Result_Obj); Set_Assignment_OK (Result_Obj);
...@@ -4213,16 +4200,16 @@ package body Exp_Ch5 is ...@@ -4213,16 +4200,16 @@ package body Exp_Ch5 is
or else Is_Possibly_Unaligned_Object (Exp) or else Is_Possibly_Unaligned_Object (Exp)
then then
declare declare
Tnn : constant Entity_Id := ExpR : constant Node_Id := Relocate_Node (Exp);
Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR);
begin begin
Insert_Action (Exp, Insert_Action (Exp,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Tnn, Defining_Identifier => Tnn,
Constant_Present => True, Constant_Present => True,
Object_Definition => New_Occurrence_Of (R_Type, Loc), Object_Definition => New_Occurrence_Of (R_Type, Loc),
Expression => Relocate_Node (Exp)), Expression => ExpR),
Suppress => All_Checks); Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
end; end;
end if; end if;
...@@ -4255,8 +4242,8 @@ package body Exp_Ch5 is ...@@ -4255,8 +4242,8 @@ package body Exp_Ch5 is
else else
declare declare
Tnn : constant Entity_Id := ExpR : constant Node_Id := Relocate_Node (Exp);
Make_Defining_Identifier (Loc, New_Internal_Name ('T')); Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR);
begin begin
-- For a complex expression of an elementary type, capture -- For a complex expression of an elementary type, capture
...@@ -4268,7 +4255,7 @@ package body Exp_Ch5 is ...@@ -4268,7 +4255,7 @@ package body Exp_Ch5 is
Defining_Identifier => Tnn, Defining_Identifier => Tnn,
Constant_Present => True, Constant_Present => True,
Object_Definition => New_Occurrence_Of (R_Type, Loc), Object_Definition => New_Occurrence_Of (R_Type, Loc),
Expression => Relocate_Node (Exp)), Expression => ExpR),
Suppress => All_Checks); Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
...@@ -4281,7 +4268,7 @@ package body Exp_Ch5 is ...@@ -4281,7 +4268,7 @@ package body Exp_Ch5 is
Make_Object_Renaming_Declaration (Loc, Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Tnn, Defining_Identifier => Tnn,
Subtype_Mark => New_Occurrence_Of (R_Type, Loc), Subtype_Mark => New_Occurrence_Of (R_Type, Loc),
Name => Relocate_Node (Exp)), Name => ExpR),
Suppress => All_Checks); Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
...@@ -4421,8 +4408,7 @@ package body Exp_Ch5 is ...@@ -4421,8 +4408,7 @@ package body Exp_Ch5 is
-- Save the Tag in a local variable Tag_Tmp -- Save the Tag in a local variable Tag_Tmp
if Save_Tag then if Save_Tag then
Tag_Tmp := Tag_Tmp := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
Append_To (Res, Append_To (Res,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -4461,8 +4447,7 @@ package body Exp_Ch5 is ...@@ -4461,8 +4447,7 @@ package body Exp_Ch5 is
New_Reference_To (Controller_Component (T), Loc)); New_Reference_To (Controller_Component (T), Loc));
end if; end if;
Prev_Tmp := Prev_Tmp := Make_Temporary (Loc, 'B');
Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
Append_To (Res, Append_To (Res,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -4477,9 +4462,7 @@ package body Exp_Ch5 is ...@@ -4477,9 +4462,7 @@ package body Exp_Ch5 is
Unchecked_Convert_To (RTE (RE_Finalizable), Ctrl_Ref), Unchecked_Convert_To (RTE (RE_Finalizable), Ctrl_Ref),
Selector_Name => Make_Identifier (Loc, Name_Prev)))); Selector_Name => Make_Identifier (Loc, Name_Prev))));
Next_Tmp := Next_Tmp := Make_Temporary (Loc, 'C');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('C'));
Append_To (Res, Append_To (Res,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -4638,9 +4621,7 @@ package body Exp_Ch5 is ...@@ -4638,9 +4621,7 @@ package body Exp_Ch5 is
Make_Integer_Literal (Loc, Make_Integer_Literal (Loc,
Intval => System_Storage_Unit)); Intval => System_Storage_Unit));
Range_Type := Range_Type := Make_Temporary (Loc, 'G');
Make_Defining_Identifier (Loc,
New_Internal_Name ('G'));
Append_To (Res, Append_To (Res,
Make_Subtype_Declaration (Loc, Make_Subtype_Declaration (Loc,
...@@ -4659,9 +4640,7 @@ package body Exp_Ch5 is ...@@ -4659,9 +4640,7 @@ package body Exp_Ch5 is
Append_To (Res, Append_To (Res,
Make_Subtype_Declaration (Loc, Make_Subtype_Declaration (Loc,
Defining_Identifier => Defining_Identifier => Make_Temporary (Loc, 'S'),
Make_Defining_Identifier (Loc,
New_Internal_Name ('S')),
Subtype_Indication => Subtype_Indication =>
Make_Subtype_Indication (Loc, Make_Subtype_Indication (Loc,
Subtype_Mark => Subtype_Mark =>
...@@ -4673,9 +4652,7 @@ package body Exp_Ch5 is ...@@ -4673,9 +4652,7 @@ package body Exp_Ch5 is
-- type A is access S -- type A is access S
Opaque_Type := Opaque_Type := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('A'));
Append_To (Res, Append_To (Res,
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
...@@ -4721,9 +4698,7 @@ package body Exp_Ch5 is ...@@ -4721,9 +4698,7 @@ package body Exp_Ch5 is
-- Last index before hole: determined by position of the -- Last index before hole: determined by position of the
-- _Controller.Prev component. -- _Controller.Prev component.
Last_Before_Hole := Last_Before_Hole := Make_Temporary (Loc, 'L');
Make_Defining_Identifier (Loc,
New_Internal_Name ('L'));
Append_To (Res, Append_To (Res,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
...@@ -4731,7 +4706,8 @@ package body Exp_Ch5 is ...@@ -4731,7 +4706,8 @@ package body Exp_Ch5 is
Object_Definition => New_Occurrence_Of ( Object_Definition => New_Occurrence_Of (
RTE (RE_Storage_Offset), Loc), RTE (RE_Storage_Offset), Loc),
Constant_Present => True, Constant_Present => True,
Expression => Make_Op_Add (Loc, Expression =>
Make_Op_Add (Loc,
Make_Attribute_Reference (Loc, Make_Attribute_Reference (Loc,
Prefix => Prev_Ref, Prefix => Prev_Ref,
Attribute_Name => Name_Position), Attribute_Name => Name_Position),
...@@ -4756,9 +4732,7 @@ package body Exp_Ch5 is ...@@ -4756,9 +4732,7 @@ package body Exp_Ch5 is
-- First index after hole -- First index after hole
First_After_Hole := First_After_Hole := Make_Temporary (Loc, 'F');
Make_Defining_Identifier (Loc,
New_Internal_Name ('F'));
Append_To (Res, Append_To (Res,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
......
...@@ -808,9 +808,7 @@ package body Exp_Ch6 is ...@@ -808,9 +808,7 @@ package body Exp_Ch6 is
Elm := First_Elmt (Var_List); Elm := First_Elmt (Var_List);
while Present (Elm) loop while Present (Elm) loop
Var := Node (Elm); Var := Node (Elm);
Ent := Ent := Make_Temporary (Loc, 'S');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('S'));
Append_Elmt (Ent, Shad_List); Append_Elmt (Ent, Shad_List);
-- Insert a declaration for this temporary at the start of the -- Insert a declaration for this temporary at the start of the
...@@ -966,9 +964,7 @@ package body Exp_Ch6 is ...@@ -966,9 +964,7 @@ package body Exp_Ch6 is
return; return;
end if; end if;
Temp := Temp := Make_Temporary (Loc, 'T');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('T'));
-- Use formal type for temp, unless formal type is an unconstrained -- Use formal type for temp, unless formal type is an unconstrained
-- array, in which case we don't have to worry about bounds checks, -- array, in which case we don't have to worry about bounds checks,
...@@ -1220,9 +1216,7 @@ package body Exp_Ch6 is ...@@ -1220,9 +1216,7 @@ package body Exp_Ch6 is
Reset_Packed_Prefix; Reset_Packed_Prefix;
Temp := Temp := Make_Temporary (Loc, 'T');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('T'));
Incod := Relocate_Node (Actual); Incod := Relocate_Node (Actual);
Outcod := New_Copy_Tree (Incod); Outcod := New_Copy_Tree (Incod);
...@@ -1387,9 +1381,7 @@ package body Exp_Ch6 is ...@@ -1387,9 +1381,7 @@ package body Exp_Ch6 is
return Entity (Actual); return Entity (Actual);
else else
Var := Var := Make_Temporary (Loc, 'T');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('T'));
N_Node := N_Node :=
Make_Object_Renaming_Declaration (Loc, Make_Object_Renaming_Declaration (Loc,
...@@ -3312,8 +3304,8 @@ package body Exp_Ch6 is ...@@ -3312,8 +3304,8 @@ package body Exp_Ch6 is
procedure Make_Exit_Label; procedure Make_Exit_Label;
-- Build declaration for exit label to be used in Return statements, -- Build declaration for exit label to be used in Return statements,
-- sets Exit_Lab (the label node) and Lab_Decl (corresponding implcit -- sets Exit_Lab (the label node) and Lab_Decl (corresponding implicit
-- declaration). -- declaration). Does nothing if Exit_Lab already set.
function Process_Formals (N : Node_Id) return Traverse_Result; function Process_Formals (N : Node_Id) return Traverse_Result;
-- Replace occurrence of a formal with the corresponding actual, or the -- Replace occurrence of a formal with the corresponding actual, or the
...@@ -3343,20 +3335,15 @@ package body Exp_Ch6 is ...@@ -3343,20 +3335,15 @@ package body Exp_Ch6 is
--------------------- ---------------------
procedure Make_Exit_Label is procedure Make_Exit_Label is
Lab_Ent : Entity_Id;
begin begin
-- Create exit label for subprogram if one does not exist yet
if No (Exit_Lab) then if No (Exit_Lab) then
Lab_Id := Lab_Ent := Make_Temporary (Loc, 'L');
Make_Identifier (Loc, Lab_Id := New_Reference_To (Lab_Ent, Loc);
Chars => New_Internal_Name ('L'));
Set_Entity (Lab_Id,
Make_Defining_Identifier (Loc, Chars (Lab_Id)));
Exit_Lab := Make_Label (Loc, Lab_Id); Exit_Lab := Make_Label (Loc, Lab_Id);
Lab_Decl := Lab_Decl :=
Make_Implicit_Label_Declaration (Loc, Make_Implicit_Label_Declaration (Loc,
Defining_Identifier => Entity (Lab_Id), Defining_Identifier => Lab_Ent,
Label_Construct => Exit_Lab); Label_Construct => Exit_Lab);
end if; end if;
end Make_Exit_Label; end Make_Exit_Label;
...@@ -3793,9 +3780,7 @@ package body Exp_Ch6 is ...@@ -3793,9 +3780,7 @@ package body Exp_Ch6 is
end if; end if;
else else
Temp := Temp := Make_Temporary (Loc, 'C');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('C'));
-- If the actual for an in/in-out parameter is a view conversion, -- If the actual for an in/in-out parameter is a view conversion,
-- make it into an unchecked conversion, given that an untagged -- make it into an unchecked conversion, given that an untagged
...@@ -3883,8 +3868,7 @@ package body Exp_Ch6 is ...@@ -3883,8 +3868,7 @@ package body Exp_Ch6 is
else else
-- Replace call with temporary and create its declaration -- Replace call with temporary and create its declaration
Temp := Temp := Make_Temporary (Loc, 'C');
Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
Set_Is_Internal (Temp); Set_Is_Internal (Temp);
-- For the unconstrained case, the generated temporary has the -- For the unconstrained case, the generated temporary has the
...@@ -4610,10 +4594,8 @@ package body Exp_Ch6 is ...@@ -4610,10 +4594,8 @@ package body Exp_Ch6 is
-- define _object later on. -- define _object later on.
declare declare
Decls : List_Id; Decls : List_Id;
Obj_Ptr : constant Entity_Id := Make_Defining_Identifier (Loc, Obj_Ptr : constant Entity_Id := Make_Temporary (Loc, 'T');
Chars =>
New_Internal_Name ('T'));
begin begin
Decls := New_List ( Decls := New_List (
...@@ -4623,7 +4605,7 @@ package body Exp_Ch6 is ...@@ -4623,7 +4605,7 @@ package body Exp_Ch6 is
Make_Access_To_Object_Definition (Loc, Make_Access_To_Object_Definition (Loc,
Subtype_Indication => Subtype_Indication =>
New_Reference_To New_Reference_To
(Corresponding_Record_Type (Scop), Loc)))); (Corresponding_Record_Type (Scop), Loc))));
Insert_Actions (N, Decls); Insert_Actions (N, Decls);
Insert_Actions (N, Freeze_Entity (Obj_Ptr, Sloc (N))); Insert_Actions (N, Freeze_Entity (Obj_Ptr, Sloc (N)));
...@@ -5117,8 +5099,7 @@ package body Exp_Ch6 is ...@@ -5117,8 +5099,7 @@ package body Exp_Ch6 is
-- Create a new access object and initialize it to the result of the -- Create a new access object and initialize it to the result of the
-- new uninitialized allocator. -- new uninitialized allocator.
Return_Obj_Access := Return_Obj_Access := Make_Temporary (Loc, 'R', Allocator);
Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
Set_Etype (Return_Obj_Access, Acc_Type); Set_Etype (Return_Obj_Access, Acc_Type);
Insert_Action (Allocator, Insert_Action (Allocator,
...@@ -5251,9 +5232,7 @@ package body Exp_Ch6 is ...@@ -5251,9 +5232,7 @@ package body Exp_Ch6 is
-- Create a temporary object to hold the function result -- Create a temporary object to hold the function result
Return_Obj_Id := Return_Obj_Id := Make_Temporary (Loc, 'R');
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('R'));
Set_Etype (Return_Obj_Id, Result_Subt); Set_Etype (Return_Obj_Id, Result_Subt);
Return_Obj_Decl := Return_Obj_Decl :=
...@@ -5406,8 +5385,7 @@ package body Exp_Ch6 is ...@@ -5406,8 +5385,7 @@ package body Exp_Ch6 is
-- Create an access type designating the function's result subtype -- Create an access type designating the function's result subtype
Ptr_Typ := Ptr_Typ := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
Ptr_Typ_Decl := Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
...@@ -5422,7 +5400,7 @@ package body Exp_Ch6 is ...@@ -5422,7 +5400,7 @@ package body Exp_Ch6 is
-- Finally, create an access object initialized to a reference to the -- Finally, create an access object initialized to a reference to the
-- function call. -- function call.
Obj_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R')); Obj_Id := Make_Temporary (Loc, 'R');
Set_Etype (Obj_Id, Ptr_Typ); Set_Etype (Obj_Id, Ptr_Typ);
Obj_Decl := Obj_Decl :=
...@@ -5684,8 +5662,7 @@ package body Exp_Ch6 is ...@@ -5684,8 +5662,7 @@ package body Exp_Ch6 is
-- Create an access type designating the function's result subtype -- Create an access type designating the function's result subtype
Ref_Type := Ref_Type := Make_Temporary (Loc, 'A');
Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
Ptr_Typ_Decl := Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc, Make_Full_Type_Declaration (Loc,
...@@ -5712,15 +5689,13 @@ package body Exp_Ch6 is ...@@ -5712,15 +5689,13 @@ package body Exp_Ch6 is
-- Finally, create an access object initialized to a reference to the -- Finally, create an access object initialized to a reference to the
-- function call. -- function call.
Def_Id :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('R'));
Set_Etype (Def_Id, Ref_Type);
New_Expr := New_Expr :=
Make_Reference (Loc, Make_Reference (Loc,
Prefix => Relocate_Node (Func_Call)); Prefix => Relocate_Node (Func_Call));
Def_Id := Make_Temporary (Loc, 'R', New_Expr);
Set_Etype (Def_Id, Ref_Type);
Insert_After_And_Analyze (Ptr_Typ_Decl, Insert_After_And_Analyze (Ptr_Typ_Decl,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id, Defining_Identifier => Def_Id,
...@@ -5744,8 +5719,7 @@ package body Exp_Ch6 is ...@@ -5744,8 +5719,7 @@ package body Exp_Ch6 is
Rewrite (Object_Decl, Rewrite (Object_Decl,
Make_Object_Renaming_Declaration (Loc, Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Defining_Identifier => Make_Temporary (Loc, 'D'),
New_Internal_Name ('D')),
Access_Definition => Empty, Access_Definition => Empty,
Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc),
Name => Call_Deref)); Name => Call_Deref));
......
...@@ -586,9 +586,7 @@ package body Exp_Ch7 is ...@@ -586,9 +586,7 @@ package body Exp_Ch7 is
-- Here we generate the required loop -- Here we generate the required loop
else else
Index := Index := Make_Temporary (Loc, 'J');
Make_Defining_Identifier (Loc, New_Internal_Name ('J'));
Append (New_Reference_To (Index, Loc), Index_List); Append (New_Reference_To (Index, Loc), Index_List);
return New_List ( return New_List (
...@@ -1162,7 +1160,7 @@ package body Exp_Ch7 is ...@@ -1162,7 +1160,7 @@ package body Exp_Ch7 is
and then not Sec_Stack_Needed_For_Return (Current_Scope) and then not Sec_Stack_Needed_For_Return (Current_Scope)
and then VM_Target = No_VM and then VM_Target = No_VM
then then
Mark := Make_Defining_Identifier (Loc, New_Internal_Name ('M')); Mark := Make_Temporary (Loc, 'M');
Append_To (New_Decls, Append_To (New_Decls,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Mark, Defining_Identifier => Mark,
...@@ -1785,9 +1783,7 @@ package body Exp_Ch7 is ...@@ -1785,9 +1783,7 @@ package body Exp_Ch7 is
end if; end if;
end if; end if;
Id := Id := Make_Temporary (Flist_Loc, 'F');
Make_Defining_Identifier (Flist_Loc,
Chars => New_Internal_Name ('F'));
end; end;
Set_Finalization_Chain_Entity (S, Id); Set_Finalization_Chain_Entity (S, Id);
...@@ -3438,7 +3434,7 @@ package body Exp_Ch7 is ...@@ -3438,7 +3434,7 @@ package body Exp_Ch7 is
-- Fxxx : Finalizable_Ptr renames Lxxx.F; -- Fxxx : Finalizable_Ptr renames Lxxx.F;
if Present (Finalization_Chain_Entity (S)) then if Present (Finalization_Chain_Entity (S)) then
LC := Make_Defining_Identifier (Loc, New_Internal_Name ('L')); LC := Make_Temporary (Loc, 'L');
-- Use the Sloc of the first declaration of N's containing list, to -- Use the Sloc of the first declaration of N's containing list, to
-- maintain monotonicity of source-line stepping during debugging. -- maintain monotonicity of source-line stepping during debugging.
......
...@@ -686,7 +686,6 @@ package body Tbuild is ...@@ -686,7 +686,6 @@ package body Tbuild is
Loc : Source_Ptr) return Node_Id Loc : Source_Ptr) return Node_Id
is is
Occurrence : Node_Id; Occurrence : Node_Id;
begin begin
Occurrence := New_Node (N_Identifier, Loc); Occurrence := New_Node (N_Identifier, Loc);
Set_Chars (Occurrence, Chars (Def_Id)); Set_Chars (Occurrence, Chars (Def_Id));
......
...@@ -180,15 +180,19 @@ package Tbuild is ...@@ -180,15 +180,19 @@ package Tbuild is
(Loc : Source_Ptr; (Loc : Source_Ptr;
Id : Character; Id : Character;
Related_Node : Node_Id := Empty) return Entity_Id; Related_Node : Node_Id := Empty) return Entity_Id;
-- This function should be used for all cases where a temporary is -- This function should be used for all cases where a defining identifier
-- built with a name to be obtained by New_Internal_Name (here Id is -- is to be built with a name to be obtained by New_Internal_Name (here Id
-- the character passed as the argument to New_Internal_Name). Loc -- is the character passed as the argument to New_Internal_Name). Loc is
-- is the location for the Sloc value of the resulting Entity. -- the location for the Sloc value of the resulting Entity. Note that this
-- can be used for all kinds of temporary defining identifiers used in
-- expansion (objects, subtypes, functions etc).
-- --
-- Related_Node is used when the identifier is capturing the value of -- Related_Node is used when the defining identifier is for an object that
-- an expression (e.g. an aggregate). It should be set whenever possible -- captures the value of an expression (e.g. an aggregate). It should be
-- to point to the expression that is being captured. This is provided -- set whenever possible to point to the expression that is being captured.
-- to get better error messages, especially from CodePeer reports. -- This is provided to get better error messages, e.g. from CodePeer.
--
-- Make_Temp_Id would probably be a better name for this function???
function Make_Unsuppress_Block function Make_Unsuppress_Block
(Loc : Source_Ptr; (Loc : Source_Ptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment