]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Perform object rewriting as renaming only in the expander
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 6 Jun 2022 08:50:23 +0000 (10:50 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 5 Jul 2022 08:28:18 +0000 (08:28 +0000)
commit69a70b0acbf01387ec1d1e85d2c7ed0d588d799e
tree67b7ab4aa3162168b8308da4ad940158aaedbf31
parent1d5018955a37fa665acc8dcba8121dd365dbe9be
[Ada] Perform object rewriting as renaming only in the expander

The rewriting as renaming optimization for object declarations is done
partly during analysis, guarded with Expander_Active, and partly during
expansion, so it makes sense to do it entirely during expansion.

This merges the two cases and removes obsolete or unnecessary conditions
guarding the transformation in the process.

gcc/ada/

* exp_ch3.adb (Expand_N_Object_Declaration): Rewrite as a renaming
for any nonaliased local object with nominal unconstrained subtype
originally initialized with the result of a function call that has
been rewritten as the dereference of a reference to the result.
* sem_ch3.adb (Analyze_Object_Declaration): Do not do it here
gcc/ada/exp_ch3.adb
gcc/ada/sem_ch3.adb