ada: Fix performance regression related to references in Refined_State
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 17 Oct 2022 20:08:37 +0000 (22:08 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 7 Nov 2022 08:36:35 +0000 (09:36 +0100)
commitdc3208e698b2f424d892d3c9e5d5562ccde9e4cf
tree0eb9b46113774e074e28f4d0d29f64844926f8cc
parentd24f279c023051c95b88b8405ac8aa4ebb44b107
ada: Fix performance regression related to references in Refined_State

Recently added call to In_Pragma_Expression caused a performance
regression. It might require climbing syntax trees of arbitrarily deep
expressions, while previously references within pragmas were detected in
bounded time.

This patch restores the previous efficiency. However, while the original
code only detected references directly within pragma argument
associations, now we also detect references inside aggregates, e.g.
like those in pragma Refined_State.

gcc/ada/

* sem_prag.adb (Non_Significant_Pragma_Reference): Detect
references with aggregates; only assign local variables Id and C
when necessary.
gcc/ada/sem_prag.adb