diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-04-05 17:07:00 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-16 09:07:17 -0400 |
commit | 1a3680ffe365ee5bf3cf8faf77ca79dca24c8634 (patch) | |
tree | 817093a70650d635b5405fcdb8d368487907d2eb | |
parent | 9d2e727e9a0de219f60b8f2f1221e88879f06116 (diff) | |
download | gcc-1a3680ffe365ee5bf3cf8faf77ca79dca24c8634.zip gcc-1a3680ffe365ee5bf3cf8faf77ca79dca24c8634.tar.gz gcc-1a3680ffe365ee5bf3cf8faf77ca79dca24c8634.tar.bz2 |
[Ada] Force evaluation of qualified aggregates
2020-06-16 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* exp_util.adb (Evaluate_Name): Force evaluation of aggregates;
recursively evaluate expression of a qualified expression; fix
location of the comment for an attribute referenced and an
indexed component.
-rw-r--r-- | gcc/ada/exp_util.adb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 47b4354..d48db56 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -4918,11 +4918,16 @@ package body Exp_Util is procedure Evaluate_Name (Nam : Node_Id) is begin - -- For an attribute reference or an indexed component, evaluate the - -- prefix, which is itself a name, recursively, and then force the - -- evaluation of all the subscripts (or attribute expressions). - case Nkind (Nam) is + -- For an aggregate, force its evaluation + + when N_Aggregate => + Force_Evaluation (Nam); + + -- For an attribute reference or an indexed component, evaluate the + -- prefix, which is itself a name, recursively, and then force the + -- evaluation of all the subscripts (or attribute expressions). + when N_Attribute_Reference | N_Indexed_Component => @@ -4960,16 +4965,10 @@ package body Exp_Util is => Force_Evaluation (Nam); - -- For a qualified expression, we evaluate the underlying object - -- name if any, otherwise we force the evaluation of the underlying - -- expression. + -- For a qualified expression, we evaluate the expression when N_Qualified_Expression => - if Is_Object_Reference (Expression (Nam)) then - Evaluate_Name (Expression (Nam)); - else - Force_Evaluation (Expression (Nam)); - end if; + Evaluate_Name (Expression (Nam)); -- For a selected component, we simply evaluate the prefix |