-- will be used to capture the aggregate assignments.
TmpE : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- New_Internal_Name ('A'));
+ Make_Temporary (Loc, New_Internal_Name ('A'), N);
TmpD : constant Node_Id :=
Make_Object_Declaration (Loc,
- Defining_Identifier =>
- TmpE,
+ Defining_Identifier => TmpE,
Object_Definition =>
New_Reference_To (SubE, Loc));
Rewrite (Parent (N), Make_Null_Statement (Loc));
else
- Temp := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Temp := Make_Temporary (Loc, New_Internal_Name ('A'), N);
-- If the type inherits unknown discriminants, use the view with
-- known discriminants if available.
else
Maybe_In_Place_OK := False;
- Tmp := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Tmp := Make_Temporary (Loc, New_Internal_Name ('A'), N);
Tmp_Decl :=
Make_Object_Declaration
(Loc,
or else Nkind (Exp) in N_Op
or else (not Name_Req and then Is_Volatile_Reference (Exp)))
then
- Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
Set_Etype (Def_Id, Exp_Type);
Res := New_Reference_To (Def_Id, Loc);
Set_Assignment_OK (E);
Insert_Action (Exp, E);
- Set_Related_Expression (Def_Id, Exp);
-- If the expression has the form v.all then we can just capture
-- the pointer, and then do an explicit dereference on the result.
elsif Nkind (Exp) = N_Explicit_Dereference then
- Def_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
Res :=
Make_Explicit_Dereference (Loc, New_Reference_To (Def_Id, Loc));
New_Reference_To (Etype (Prefix (Exp)), Loc),
Constant_Present => True,
Expression => Relocate_Node (Prefix (Exp))));
- Set_Related_Expression (Def_Id, Exp);
-- Similar processing for an unchecked conversion of an expression
-- of the form v.all, where we want the same kind of treatment.
-- Use a renaming to capture the expression, rather than create
-- a controlled temporary.
- Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
Res := New_Reference_To (Def_Id, Loc);
Insert_Action (Exp,
Defining_Identifier => Def_Id,
Subtype_Mark => New_Reference_To (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
- Set_Related_Expression (Def_Id, Exp);
else
- Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
Set_Etype (Def_Id, Exp_Type);
Res := New_Reference_To (Def_Id, Loc);
Set_Assignment_OK (E);
Insert_Action (Exp, E);
- Set_Related_Expression (Def_Id, Exp);
end if;
-- For expressions that denote objects, we can use a renaming scheme.
and then Nkind (Exp) /= N_Function_Call
and then (Name_Req or else not Is_Volatile_Reference (Exp))
then
- Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
if Nkind (Exp) = N_Selected_Component
and then Nkind (Prefix (Exp)) = N_Function_Call
Name => Relocate_Node (Exp)));
end if;
- Set_Related_Expression (Def_Id, Exp);
-
-- If this is a packed reference, or a selected component with a
-- non-standard representation, a reference to the temporary will
-- be replaced by a copy of the original expression (see
then
declare
Obj : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('F'));
+ Make_Temporary (Loc, New_Internal_Name ('F'), Exp);
Decl : Node_Id;
begin
Expression => Relocate_Node (Exp));
Insert_Action (Exp, Decl);
Set_Etype (Obj, Exp_Type);
- Set_Related_Expression (Obj, Exp);
Rewrite (Exp, New_Occurrence_Of (Obj, Loc));
return;
end;
E := Exp;
Insert_Action (Exp, Ptr_Typ_Decl);
- Def_Id := Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Def_Id := Make_Temporary (Loc, New_Internal_Name ('R'), Exp);
Set_Etype (Def_Id, Exp_Type);
Res :=
Defining_Identifier => Def_Id,
Object_Definition => New_Reference_To (Ref_Type, Loc),
Expression => New_Exp));
- Set_Related_Expression (Def_Id, Exp);
end if;
-- Preserve the Assignment_OK flag in all copies, since at least