ada: Make Apply_Discriminant_Check.Denotes_Explicit_Dereference more robust
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 8 Dec 2022 22:21:58 +0000 (23:21 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 3 Jan 2023 09:29:53 +0000 (10:29 +0100)
commit32841e7e8480cb16d34f60feda226e4f582c3186
tree60d866e4fd81c68f950a4ddddc5c912cd589cdf2
parentbfe1ab222a8095b31c29d8f3530268f048fea00f
ada: Make Apply_Discriminant_Check.Denotes_Explicit_Dereference 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 and adds the
detection of rewritten return objects.

gcc/ada/

* checks.adb (Apply_Discriminant_Check.Denotes_Explicit_Dereference):
Return false for artificial dereferences generated by the expander.
gcc/ada/checks.adb