[Ada] Finding proper scope when inside entry body

Pierre-Marie de Rodat derodat@adacore.com
Thu Jan 11 09:05:00 GMT 2018


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.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1535 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180111/6f1595ed/attachment.bin>


More information about the Gcc-patches mailing list