]> gcc.gnu.org Git - gcc.git/commit
[Ada] Implement component finalization ordering rules for type extensions
authorSteve Baird <baird@adacore.com>
Thu, 3 Mar 2022 22:35:31 +0000 (14:35 -0800)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:03 +0000 (08:42 +0000)
commit7c88e46a270212180767fc585dd190b7713702db
tree8c8df550b477a71d7cbf40e3e36cef252824bcc9
parent909ce3528c800676fbbebe1f9a0047d14378861e
[Ada] Implement component finalization ordering rules for type extensions

Finalization of a record object is required to finalize any components
that have an access discriminant constrained by a per-object expression
before other components. This includes the case of a type extension;
"early finalization" components of the parent type are required to be
finalized before non-early-finalization extension components. This is
implemented in the extension type's finalization procedure by placing
the call to the parent type's finalization procedure between the
finalization of the "early finalization" extension components and the
finalization of the other extension components. Previously that call was
executed after finalizing all of the extension conponents.

gcc/ada/

* exp_ch7.adb (Build_Finalize_Statements): Add Last_POC_Call
variable to keep track of the last "early finalization" call
generated for type extension's finalization procedure. If
non-empty, then this will indicate the point at which to insert
the call to the parent type's finalization procedure. Modify
nested function Process_Component_List_For_Finalize to set this
variable (and avoid setting it during a recursive call).  If
Last_POC_Call is empty, then insert the parent finalization call
before, rather than after, the finalization code for the
extension components.
gcc/ada/exp_ch7.adb
This page took 0.056563 seconds and 5 git commands to generate.