aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/types.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2022-05-26 10:27:42 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-04 07:45:57 +0000
commit4b766285b089ba1bce91a7644b9d97836e80cda3 (patch)
tree1d9f62e39d22a645449d7b48e490e3a2b6fbb8ef /gcc/ada/types.ads
parent78f13b008ab58794057847a74903ee4569829d80 (diff)
downloadgcc-4b766285b089ba1bce91a7644b9d97836e80cda3.zip
gcc-4b766285b089ba1bce91a7644b9d97836e80cda3.tar.gz
gcc-4b766285b089ba1bce91a7644b9d97836e80cda3.tar.bz2
[Ada] Assertions in Einfo.Utils
Add predicates on subtypes E and N. gcc/ada/ * einfo-utils.ads, einfo-utils.adb: Add predicates on subtypes E and N. Change some parameters to use the unpredicated subtypes, because they sometimes return e.g. Empty. Note that N_Entity_Id has a predicate; Entity_Id does not. * exp_tss.adb (Base_Init_Proc): Use Entity_Id instead of E, because otherwise we fail the predicate. We shouldn't be referring to single-letter names from far away anyway. * sem_aux.adb (Is_Derived_Type): Likewise. * sem_res.adb (Is_Definite_Access_Type): Use N_Entity_Id for predicate. * types.ads (Entity_Id): Add comment explaining the difference between Entity_Id and N_Entity_Id.
Diffstat (limited to 'gcc/ada/types.ads')
-rw-r--r--gcc/ada/types.ads5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index 3b226e1..9ae1797 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -404,6 +404,11 @@ package Types is
-- that are entities (i.e. nodes with an Nkind of N_Defining_xxx). All such
-- nodes are extended nodes and these are the only extended nodes, so that
-- in practice entity and extended nodes are synonymous.
+ --
+ -- Note that Sinfo.Nodes.N_Entity_Id is the same as Entity_Id, except it
+ -- has a predicate requiring the correct Nkind. Opt_N_Entity_Id is the same
+ -- as N_Entity_Id, except it allows Empty. (Sinfo.Nodes is generated by the
+ -- Gen_IL program.)
subtype Node_Or_Entity_Id is Node_Id;
-- A synonym for node types, used in cases where a given value may be used