Commit 1debd630 by Yannick Moy Committed by Pierre-Marie de Rodat

[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
parent d39f6b24
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.
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment