]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Make Sem_Util.Is_Aliased_View predicate more robust
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 7 Dec 2022 16:26:27 +0000 (17:26 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 3 Jan 2023 09:29:53 +0000 (10:29 +0100)
commit83d52e6de23f65cefde615183cdef1eb94d18b1f
tree1ced4614e9f0c0565dc6708b7c356e73096d7cbd
parent1fc93c2437dd3bc5cfd19b1397b9b0ca4c5f4064
ada: Make Sem_Util.Is_Aliased_View predicate more robust

The predicate implements the rules of the language so it needs to cope with
constructs rewritten by the expander, in particular explicit dereferences
that the expander uses liberally for various purposes.

This change makes the detection of rewritten calls more robust, plugging an
existing loophole for specific objects and exposing a missing propagation of
the Is_Aliased flag for certain build-in-place objects, as well as adds the
detection of rewritten return objects.

It also contains a small enhancement to Set_Debug_Info_Defining_Id aimed at
making it easier to debug the generated code by means of -gnatD.

gcc/ada/

* sem_util.ads (Set_Debug_Info_Defining_Id): Adjust comment.
* sem_util.adb (Is_Aliased_View) <N_Explicit_Dereference>: Return
false for more artificial dereferences generated by the expander.
(Set_Debug_Info_Defining_Id): Set Debug_Info_Needed unconditionally
in -gnatD mode.
* exp_ch6.adb (Replace_Renaming_Declaration_Id): Also preserve the
Is_Aliased flag.
gcc/ada/exp_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads