aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/treepr.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/treepr.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/treepr.adb')
-rw-r--r--gcc/ada/treepr.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index d36042c..aa06506 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -1024,6 +1024,8 @@ package body Treepr is
FD : Field_Descriptor;
Format : UI_Format := Auto)
is
+ pragma Assert (FD.Type_Only = No_Type_Only);
+ -- Type_Only is for entities
begin
if not Field_Is_Initial_Zero (N, Field) then
Print_Field (Prefix, Image (Field), N, FD, Format);
@@ -1041,9 +1043,10 @@ package body Treepr is
FD : Field_Descriptor;
Format : UI_Format := Auto)
is
+ NN : constant Node_Id := Node_To_Fetch_From (N, Field);
begin
if not Field_Is_Initial_Zero (N, Field) then
- Print_Field (Prefix, Image (Field), N, FD, Format);
+ Print_Field (Prefix, Image (Field), NN, FD, Format);
end if;
end Print_Entity_Field;