]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Finding proper scope when inside entry body
authorHristian Kirtchev <kirtchev@adacore.com>
Thu, 11 Jan 2018 08:51:09 +0000 (08:51 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 11 Jan 2018 08:51:09 +0000 (08:51 +0000)
commit775192706061030d927945619d3a41c5825e455d
treeead74251977d1087036b9eaa9f080a27fb8b4055
parenta40d994753b00e453f5b97686bebed73e7de6692
[Ada] Finding proper scope when inside entry body

This patch modifies routine Find_Enclosing_Scope which obtains the scope of an
arbitrary node to return the unique defining entity of an enclosing body. This
automatically takes care of the following corner cases:

   * The body is a subprogram body which does not complete a previous
     declaration. In this case the proper scope is the entity of the
     body.

   * The body is an entry body. Due to a limitation in the AST, the
     entry body does not store its correcponsing spec, but utilizes a
     roundabout way of obtaining it. Regardless of the limitation, the
     proper scope is the entity of the entry declaration.

The issue was discovered during the development of the GNATprove tool and
is not visible to end users. No simple test is available because this would
require a debug session.

2018-01-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_util.adb (Find_Enclosing_Scope): Return the unique defining
entity when the enclosing construct is a body.

From-SVN: r256489
gcc/ada/ChangeLog
gcc/ada/sem_util.adb