aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2019-08-12 08:59:47 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-12 08:59:47 +0000
commit1debd630ed40eec6db2f4aab4524fde4643b70a7 (patch)
treeeaba4c9248223b898394ac925f3e7b6eb9e7077b
parentd39f6b24d401c8a945fae1488de0dea2252ec7ae (diff)
downloadgcc-1debd630ed40eec6db2f4aab4524fde4643b70a7.zip
gcc-1debd630ed40eec6db2f4aab4524fde4643b70a7.tar.gz
gcc-1debd630ed40eec6db2f4aab4524fde4643b70a7.tar.bz2
[Ada] Adapt new extended traversal of AST to have optional part
The new extended traversal of the AST for GNATprove use now optionally traverses the ranges under Itypes, based on a formal parameter. There is no impact on compilation. 2019-08-12 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_util.adb, sem_util.ads (Traverse_More_Func, Traverse_More_Proc): Add formal parameter for Itypes traversal. From-SVN: r274291
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_util.adb12
-rw-r--r--gcc/ada/sem_util.ads3
3 files changed, 15 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ca2030d..5e8fd9e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2019-08-12 Yannick Moy <moy@adacore.com>
+ * sem_util.adb, sem_util.ads (Traverse_More_Func,
+ Traverse_More_Proc): Add formal parameter for Itypes traversal.
+
+2019-08-12 Yannick Moy <moy@adacore.com>
+
* exp_attr.adb, exp_attr.ads (Expand_Size_Attribute): New
procedure to share part of the attribute expansion with
GNATprove mode.
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index acc257c..b56fa86 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25565,11 +25565,13 @@ package body Sem_Util is
null;
end case;
- -- Then process unattached nodes which come from Itypes. This only
- -- concerns currently ranges of scalar (possibly as index) types.
- -- This traversal is protected against looping with Processing_Itype.
+ -- If Process_Itypes is True, process unattached nodes which come
+ -- from Itypes. This only concerns currently ranges of scalar
+ -- (possibly as index) types. This traversal is protected against
+ -- looping with Processing_Itype.
- if not Processing_Itype
+ if Process_Itypes
+ and then not Processing_Itype
and then Nkind (Node) in N_Has_Etype
and then Present (Etype (Node))
and then Is_Itype (Etype (Node))
@@ -25628,7 +25630,7 @@ package body Sem_Util is
------------------------
procedure Traverse_More_Proc (Node : Node_Id) is
- function Traverse is new Traverse_More_Func (Process);
+ function Traverse is new Traverse_More_Func (Process, Process_Itypes);
Discard : Traverse_Final_Result;
pragma Warnings (Off, Discard);
begin
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 478f570..2c1f8a8 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -2814,14 +2814,17 @@ package Sem_Util is
generic
with function Process (N : Node_Id) return Traverse_Result is <>;
+ Process_Itypes : Boolean := False;
function Traverse_More_Func (Node : Node_Id) return Traverse_Final_Result;
-- This is a version of Atree.Traverse_Func that not only traverses
-- syntactic children of nodes, but also semantic children which are
-- logically children of the node. This concerns currently lists of
-- action nodes and ranges under Itypes, both inserted by the compiler.
+ -- Itypes are only traversed when Process_Itypes is True.
generic
with function Process (N : Node_Id) return Traverse_Result is <>;
+ Process_Itypes : Boolean := False;
procedure Traverse_More_Proc (Node : Node_Id);
pragma Inline (Traverse_More_Proc);
-- This is the same as Traverse_More_Func except that no result is