ada: Simplify finalization of temporaries created for interface objects
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 25 Dec 2022 21:25:21 +0000 (22:25 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 9 Jan 2023 14:42:23 +0000 (15:42 +0100)
commitd4eaf83d6eff980ec001bd54f2c4e87b34057bf6
tree20c6dcccd41d97fe319e521314182d8447ac0258
parent46034c46f82dec169fe7fc7c2d82d8321d9a9512
ada: Simplify finalization of temporaries created for interface objects

The expansion of (class-wide) interface objects generates a temporary that
holds the actual data and the objects are rewritten as the renaming of the
dereference at the interface tag present in it. These temporaries may need
to be finalized and this is currently done through the renamings, by using
pattern matching to recognize the original source constructs.

Now these temporaries may also need to be adjusted and this is currently
done "naturally", i.e. by using the standard machinery for them, so there
is no fundamental reason why the finalization cannot be done this way too.

Therefore this changes removes the special machinery implemented for their
finalization and let them be handled by the standard one instead.

gcc/ada/

* exp_util.ads (Is_Tag_To_Class_Wide_Conversion): Delete.
(Is_Displacement_Of_Object_Or_Function_Result): Likewise.
* exp_util.adb (Is_Tag_To_Class_Wide_Conversion): Rename to...
(Is_Temporary_For_Interface_Object): ...this.
(Is_Finalizable_Transient): Adjust call to above renaming.
(Is_Displacement_Of_Object_Or_Function_Result): Delete.
(Requires_Cleanup_Actions): Remove special handling of the
temporaries created for interface objects.
* exp_ch7.adb (Build_Finalizer): Likewise.
gcc/ada/exp_ch7.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads