[Ada] Improve code generated for assignment of dynamic record aggregates
2020-06-12 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_aggr.adb: Add with and use clauses for Sem_Mech.
(Get_Base_Object): New function to get the base object of a node.
(In_Place_Assign_OK): Add Target_Object parameter. Deal with a
qualified expression on entry. Remove short-circuit for array
aggregates with a single "others" choice. Do not look into the
components of the aggregate if the parent is an allocator.
(Check_Component): Add T_OK parameter and rewrite.
(Safe_Component): Invoke Check_Component with T_OK set to False.
(Convert_To_Assignments): Try to use an in-place assignment for
any target; for that, call Get_Base_Object on the target and pass
the result to In_Place_Assign_OK.
(Expand_Array_Aggregate): Use Parent_Kind and Parent_Node more
consistently. For an assignment, call Get_Base_Object on the
target and pass the result to In_Place_Assign_OK.