summaryrefslogtreecommitdiff
path: root/gcc/ada/atree.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/atree.ads')
-rw-r--r--gcc/ada/atree.ads15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index 4861236b669..c239507c93c 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -47,6 +47,7 @@
with Alloc;
with Sinfo.Nodes; use Sinfo.Nodes;
with Einfo.Entities; use Einfo.Entities;
+with Einfo.Utils; use Einfo.Utils;
with Types; use Types;
with Seinfo; use Seinfo;
with System; use System;
@@ -616,6 +617,20 @@ package Atree is
-- always the same; for example we change from E_Void, to E_Variable, to
-- E_Void, to E_Constant.
+ function Node_To_Fetch_From
+ (N : Node_Or_Entity_Id; Field : Node_Or_Entity_Field)
+ return Node_Or_Entity_Id is
+ (case Field_Descriptors (Field).Type_Only is
+ when No_Type_Only => N,
+ when Base_Type_Only => Base_Type (N),
+ when Impl_Base_Type_Only => Implementation_Base_Type (N),
+ when Root_Type_Only => Root_Type (N));
+ -- This is analogous to the same-named function in Gen_IL.Gen. Normally,
+ -- Type_Only is No_Type_Only, and we fetch the field from the node N. But
+ -- if Type_Only = Base_Type_Only, we need to go to the Base_Type, and
+ -- similarly for the other two cases. This can return something other
+ -- than N only if N is an Entity.
+
-----------------------------
-- Private Part Subpackage --
-----------------------------