public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] c++: overload dumper
@ 2020-08-28 16:01 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-08-28 16:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:311281441cbea05691aec4fb1b5ebff39106cd5b

commit 311281441cbea05691aec4fb1b5ebff39106cd5b
Author: Nathan Sidwell <nathan@acm.org>
Date:   Mon Aug 24 06:28:37 2020 -0700

    c++: overload dumper
    
    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.

Diff:
---
 gcc/cp/ptree.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index dfc244fdceb..11833e3b4da 100644
--- a/gcc/cp/ptree.c
+++ b/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);
+    }
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-28 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 16:01 [gcc/devel/c++-modules] c++: overload dumper Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).