[Ada] Adapt ownership checking in SPARK to traversal functions
authorYannick Moy <moy@adacore.com>
Mon, 22 Jul 2019 13:58:23 +0000 (13:58 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 22 Jul 2019 13:58:23 +0000 (13:58 +0000)
commita211917585ca978a84123c4c934f2f68bb545bcd
treee3c7490668db893acc003edd9ee3062f84c3f77b
parent8113b0c7385727d9969db2c8420bc0a3d6b8f0ed
[Ada] Adapt ownership checking in SPARK to traversal functions

A traversal function, especially when implemented as an expression
function, may need to return an if-expression or case-expression, while
still respecting Legality Rule SPARK RM 3.10(5). This case is now
allowed in GNATprove.

There is no impact on compilation.

2019-07-22  Yannick Moy  <moy@adacore.com>

gcc/ada/

* sem_spark.adb (Get_Root_Object, Is_Path_Expression,
Is_Subpath_Expression): Add parameter Is_Traversal to adapt
these functions to the case of paths returned from a traversal
function.
(Read_Indexes): Handle the case of an if-expression or
case-expression.
(Check_Statement): Check Emit_Messages only when issuing an
error message. This is important as Emit_Messages may store the
information that an error was detected.

From-SVN: r273693
gcc/ada/ChangeLog
gcc/ada/sem_spark.adb