aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo-utils.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-10-20 16:55:38 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-10-25 15:07:21 +0000
commit034c3117520f33bc108afc930c16b220041e4a97 (patch)
tree6f9632f0f7f159bcdc8bf527b4020410328d77c8 /gcc/ada/sinfo-utils.adb
parent234815d4c38608eb1bff20f68d6dd4c233f07725 (diff)
downloadgcc-034c3117520f33bc108afc930c16b220041e4a97.zip
gcc-034c3117520f33bc108afc930c16b220041e4a97.tar.gz
gcc-034c3117520f33bc108afc930c16b220041e4a97.tar.bz2
[Ada] Fix bugs in Base_Type_Only (etc.) fields
gcc/ada/ * gen_il-gen.adb (Put_Seinfo): Generate type Seinfo.Type_Only_Enum based on type Gen_IL.Internals.Type_Only_Enum. Automatically generating a copy of the type will help keep them in sync. (Note that there are no Ada compiler packages imported into Gen_IL.) Add a Type_Only field to Field_Descriptor, so this information is available in the Ada compiler (as opposed to just in the Gen_IL "compiler"). (One_Comp): Add initialization of the Type_Only field of Field_Descriptor. * gen_il-internals.ads (Image): Image function for Type_Only_Enum. * atree.ads (Node_To_Fetch_From): New function to compute which node to fetch from, based on the Type_Only aspect. * atree.adb (Get_Field_Value): Call Node_To_Fetch_From. * treepr.adb (Print_Entity_Field): Call Node_To_Fetch_From. (Print_Node_Field): Assert. * sinfo-utils.adb (Walk_Sinfo_Fields, Walk_Sinfo_Fields_Pairwise): Asserts.
Diffstat (limited to 'gcc/ada/sinfo-utils.adb')
-rw-r--r--gcc/ada/sinfo-utils.adb4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ada/sinfo-utils.adb b/gcc/ada/sinfo-utils.adb
index 79269a5..33247e2 100644
--- a/gcc/ada/sinfo-utils.adb
+++ b/gcc/ada/sinfo-utils.adb
@@ -279,6 +279,8 @@ package body Sinfo.Utils is
declare
Desc : Field_Descriptor renames
Field_Descriptors (Fields (J));
+ pragma Assert (Desc.Type_Only = No_Type_Only);
+ -- Type_Only is for entities
begin
if Is_In_Union_Id (Desc.Kind) then
Action (Get_Node_Field_Union (N, Desc.Offset));
@@ -304,6 +306,8 @@ package body Sinfo.Utils is
declare
Desc : Field_Descriptor renames
Field_Descriptors (Fields (J));
+ pragma Assert (Desc.Type_Only = No_Type_Only);
+ -- Type_Only is for entities
begin
if Is_In_Union_Id (Desc.Kind) then
Set_Node_Field_Union