diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-08-24 06:28:37 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-08-24 06:28:37 -0700 |
commit | 311281441cbea05691aec4fb1b5ebff39106cd5b (patch) | |
tree | 8d14c25232d1e230d8ffa6a40b8518aa69179c96 /gcc/cp/ptree.c | |
parent | de09e7ebc9d5555653745a103eef2b20c7f1dd76 (diff) | |
download | gcc-311281441cbea05691aec4fb1b5ebff39106cd5b.zip gcc-311281441cbea05691aec4fb1b5ebff39106cd5b.tar.gz gcc-311281441cbea05691aec4fb1b5ebff39106cd5b.tar.bz2 |
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.
Diffstat (limited to 'gcc/cp/ptree.c')
-rw-r--r-- | gcc/cp/ptree.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index dfc244f..11833e3 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); + } +} |