]> gcc.gnu.org Git - gcc.git/commit
ada: Deep delta aggregates
authorSteve Baird <baird@adacore.com>
Fri, 22 Sep 2023 18:54:13 +0000 (11:54 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 Nov 2023 09:57:41 +0000 (10:57 +0100)
commit0191a24e2bedc6bd3de16b7e679a39fa518d65f7
tree751f1d4f60d5c9af62ab61bd230d7b4c81e80ca3
parenta5fbba52e98f8685220ce13d06716cde2ed6a598
ada: Deep delta aggregates

Add support for "deep" delta aggregates, a GNAT-defined language extension
conditionally enabled via the -gnatX0 switch. In a deep delta aggregate, a
delta choice may specify a subcomponent (as opposed to just a component).

gcc/ada/

* par.adb: Add new Boolean variable Inside_Delta_Aggregate.
* par-ch4.adb (P_Simple_Expression): Add support for a deep delta
aggregate choice. We turn a sequence of selectors into a peculiar
tree. We build a component (Indexed or Selected) whose prefix is
another such component, etc. The leftmost prefix at the bottom of
the tree has a "name" which is the first selector, without any
further prefix. For something like "with delta (1)(2) => 3" where
the type of the aggregate is an array of arrays of integers, we'll
build an N_Indexed_Component whose prefix is an integer literal 1.
This is consistent with the trees built for "regular"
(Ada-defined) delta aggregates.
* sem_aggr.adb (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
New queries.
(Resolve_Deep_Delta_Assoc): new procedure.
(Resolve_Delta_Array_Aggregate): call Resolve_Deep_Delta_Assoc in
deep case.
(Resolve_Delta_Record_Aggregate): call Resolve_Deep_Delta_Assoc in
deep case.
(Get_Component_Type): new function replaces old Get_Component
function.
* sem_aggr.ads (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
New queries.
* exp_aggr.adb (Expand_Delta_Array_Aggregate): add nested function
Make_Array_Delta_Assignment_LHS; call it instead of
Make_Indexed_Component.
(Expand_Delta_Record_Aggregate): add nested function
Make_Record_Delta_Assignment_LHS; call it instead of
Make_Selected_Component.
* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Insert range
checks for indexes in deep delta aggregates.
gcc/ada/exp_aggr.adb
gcc/ada/exp_spark.adb
gcc/ada/par-ch4.adb
gcc/ada/par.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_aggr.ads
This page took 0.057215 seconds and 5 git commands to generate.