diff mbox series

c++: overload dumper

Message ID c262e54e-4f10-a368-5cf1-d7fb91f503f9@acm.org
State New
Headers show
Series c++: overload dumper | expand

Commit Message

Nathan Sidwell Aug. 24, 2020, 1:31 p.m. UTC
I frequently need to look at overload sets, and debug_node spews more
information than is useful, most of the time.  Here's a dumper for
overloads, that just tells you their full name and where they came from.

         gcc/cp
         * ptree.c (debug_overload): New.

pushed
diff mbox series

Patch

diff --git c/gcc/cp/ptree.c w/gcc/cp/ptree.c
index dfc244fdceb..11833e3b4da 100644
--- c/gcc/cp/ptree.c
+++ w/gcc/cp/ptree.c
@@ -321,3 +321,19 @@  debug_tree (cp_expr node)
 {
   debug_tree (node.get_value());
 }
+
+DEBUG_FUNCTION void
+debug_overload (tree node)
+{
+  FILE *file = stdout;
+
+  for (lkp_iterator iter (node); iter; ++iter)
+    {
+      tree decl = *iter;
+      auto xloc = expand_location (DECL_SOURCE_LOCATION (decl));
+      auto fullname = decl_as_string (decl, 0);
+
+      fprintf (file, "%p: %s:%d:%d \"%s\"\n", (void *)decl,
+	       xloc.file, xloc.line, xloc.column, fullname);
+    }
+}