ada: Update Controlling_Argument when copying trees
commit01b0a60038a91d5607e8f64d18bfa43984255632
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 27 Jan 2023 11:37:25 +0000 (27 12:37 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 22 May 2023 08:44:07 +0000 (22 10:44 +0200)
tree426253e24706059c404949aeb3c8fba28f6ef409
parente7f7018c2a5f07e6e8a045b6ba18c023daed7010
ada: Update Controlling_Argument when copying trees

When copying the AST we need to update fields that carry semantic
meaning and not just copy them. We already updated some of them,
e.g. the First/Next_Named_Association chain, but failed to update
the Controlling_Argument.

This fix doesn't appear to change anything for the compiler, but it is
needed for GNATprove, where we no longer want to expand expression
functions and instead we want to copy their preanalyzed expressions.

gcc/ada/

* sem_util.ads (New_Copy_Tree): Update comment.
* sem_util.adb (New_Copy_Tree): Update Controlling_Argument, very
much like we update the First/Next_Named_Association.
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads