aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2021-11-05 15:22:05 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-12-01 10:24:42 +0000
commitbb2fc099e28c6e0fc3f77598c514fa6ec72d846d (patch)
tree32125e9ef4a86d75953b9001c2722254d9cb9a99 /gcc/gimplify.c
parentbe6bb3fc57e2af376e5c18eeca51119e87a55ee3 (diff)
downloadgcc-bb2fc099e28c6e0fc3f77598c514fa6ec72d846d.zip
gcc-bb2fc099e28c6e0fc3f77598c514fa6ec72d846d.tar.gz
gcc-bb2fc099e28c6e0fc3f77598c514fa6ec72d846d.tar.bz2
[Ada] Improve support for casing on types with controlled parts
gcc/ada/ * sem_case.adb (Check_Bindings): Provide a second strategy for implementing bindings and choose which strategy to use for a given binding. The previous approach was to introduce a new object and assign the bound value to the object. The new approach is to introduce a renaming of a dereference of an access value that references the appropriate subcomponent, so no copies are made. The original strategy is still used if the type of the object is elementary. When the renaming approach is used, the initialization of the access value is not generated until expansion. Until this missing initialization is added, the tree looks like a known-at-compile-time dereference of a null access value: Temp : Some_Access_Type; Obj : Designated_Type renames Temp.all; This leads to problems, so a bogus initial value is provided here and then later deleted during expansion. (Check_Composite_Case_Selector): Disallow a case selector expression that requires finalization. Note that it is ok if the selector's type requires finalization, as long as the expression itself doesn't have any "newly constructed" parts. * exp_ch5.adb (Pattern_Match): Detect the case where analysis of a general (i.e., composite selector type) case statement chose to implement a binding as a renaming rather than by making a copy. In that case, generate the assignments to initialize the access-valued object whose designated value is later renamed (and remove the bogus initial value for that object that was added during analysis). * sem_util.ads, sem_util.adb: Add new function Is_Newly_Constructed corresponding to RM 4.4 term.
Diffstat (limited to 'gcc/gimplify.c')
0 files changed, 0 insertions, 0 deletions