diff mbox

C++ PATCH to announce template instantiations if not -quiet

Message ID CADzB+2khk-=F9nJxOc9y0NSxyjuJPSUbj7=U3vnKHy5Bug29Vg@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Nov. 7, 2016, 7:34 p.m. UTC
It occurred to me that a simple trace of template instantiations would
fit simply into the stream of function declarations that
announce_function prints when -quiet is not specified to the compiler.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit ae7b4a929fbd05de433451a1d92794d962366646
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Nov 4 09:22:32 2016 -0400

    Add template instantiations to the announce_function stream.
    
            * pt.c (push_tinst_level_loc): Add template instantiations to the
            announce_function stream.
diff mbox

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c8d4a06..f910d40 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9170,6 +9170,13 @@  push_tinst_level_loc (tree d, location_t loc)
   if (limit_bad_template_recursion (d))
     return false;
 
+  /* When not -quiet, dump template instantiations other than functions, since
+     announce_function will take care of those.  */
+  if (!quiet_flag
+      && TREE_CODE (d) != TREE_LIST
+      && TREE_CODE (d) != FUNCTION_DECL)
+    fprintf (stderr, " %s", decl_as_string (d, TFF_DECL_SPECIFIERS));
+
   new_level = ggc_alloc<tinst_level> ();
   new_level->decl = d;
   new_level->locus = loc;