]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Display Entity in debugging printouts
authorBob Duff <duff@adacore.com>
Thu, 4 Mar 2021 21:27:05 +0000 (16:27 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 17 Jun 2021 14:32:09 +0000 (10:32 -0400)
gcc/ada/

* treepr.adb (Print_Node): Display the Entity or Associated_Node
fields if appropriate.
* sinfo-utils.ads (F_Associated_Node, F_Entity): Remove. These
are no longer needed.

gcc/ada/sinfo-utils.ads
gcc/ada/treepr.adb

index dce659232f470f06b591276c0e45e41ada5c720b..ab8e52866dc25809a3d2d059801ddd9d520d0d01 100644 (file)
@@ -139,12 +139,6 @@ package Sinfo.Utils is
      (N : N_Inclusive_Has_Entity; Val : Node_Id)
       renames Set_Entity_Or_Associated_Node;
 
-   function F_Associated_Node return Node_Field renames
-     F_Entity_Or_Associated_Node;
-   function F_Entity return Node_Field renames
-     F_Entity_Or_Associated_Node;
-   --  Note that we are renaming the enumeration literals here
-
    ---------------
    -- Debugging --
    ---------------
index 50d4ca3ccbddb86da64bfddb03fefd0389da2d79..d869ea7298722fe2efc2722fb260263976898403 100644 (file)
@@ -1272,14 +1272,22 @@ package body Treepr is
             Print_Eol;
          end if;
 
-         --  Print Entity field if operator (other cases of Entity
-         --  are in the table, so are handled in the normal circuit)
+         --  Deal with Entity_Or_Associated_Node. If N has both, then just
+         --  print Entity; they are the same thing.
 
-         if Nkind (N) in N_Op and then Present (Entity (N)) then
+         if N in N_Inclusive_Has_Entity and then Present (Entity (N)) then
             Print_Str (Prefix);
             Print_Str ("Entity = ");
             Print_Node_Ref (Entity (N));
             Print_Eol;
+
+         elsif N in N_Has_Associated_Node
+           and then Present (Associated_Node (N))
+         then
+            Print_Str (Prefix);
+            Print_Str ("Associated_Node = ");
+            Print_Node_Ref (Associated_Node (N));
+            Print_Eol;
          end if;
 
          --  Print special fields if we have a subexpression
@@ -1391,7 +1399,7 @@ package body Treepr is
             | F_Sloc
             | F_Left_Opnd
             | F_Right_Opnd
-            | F_Entity
+            | F_Entity_Or_Associated_Node -- one of them was printed
             | F_Assignment_OK
             | F_Do_Range_Check
             | F_Has_Dynamic_Length_Check