[Ada] Fix implementation of utility for finding enclosing declaration
authorYannick Moy <moy@adacore.com>
Wed, 23 May 2018 10:22:57 +0000 (10:22 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 23 May 2018 10:22:57 +0000 (10:22 +0000)
This utility is used in GNATprove to find when a node is inside a named
number declaration, and this case was not properly handled. Now fixed.
There is no impact on compilation.

2018-05-23  Yannick Moy  <moy@adacore.com>

gcc/ada/

* sem_util.adb (Enclosing_Declaration): Fix the case of a named number
declaration, which was not taken into account.

From-SVN: r260586

gcc/ada/ChangeLog
gcc/ada/sem_util.adb

index f24eda6..b309616 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-23  Yannick Moy  <moy@adacore.com>
+
+       * sem_util.adb (Enclosing_Declaration): Fix the case of a named number
+       declaration, which was not taken into account.
+
 2018-05-23  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * debug.adb: Switch -gnatd_s is now used to stop elaboration checks on
index 875b9eb..2d516ff 100644 (file)
@@ -6635,7 +6635,9 @@ package body Sem_Util is
       while Present (Decl)
         and then not (Nkind (Decl) in N_Declaration
                         or else
-                      Nkind (Decl) in N_Later_Decl_Item)
+                      Nkind (Decl) in N_Later_Decl_Item
+                        or else
+                      Nkind (Decl) = N_Number_Declaration)
       loop
          Decl := Parent (Decl);
       end loop;