Add a -fdump-template-instantiations option in order to dump the C++ template instantiations. Please assign this to andres.tiraboschi@tallertechnologies.com .
What do you plan to implement? It would be better to produce output compatible with Templight (http://plc.inf.elte.hu/templight/) rather than a GCC-specific dump.
(In reply to Jonathan Wakely from comment #1) > What do you plan to implement? It would be better to produce output > compatible with Templight (http://plc.inf.elte.hu/templight/) rather than a > GCC-specific dump. Actually I planned to implement the human-friendly format that gcc currently outputs when an instantiation fails [with T=...], which I think it will be useful for most users; however I admit that hving templight support is interesting. So I propose to implement -fdump-template-instantations=human or alike, leaving the code cleanly ready to add other dump formats (such as =templight) or =plugin to enable user-defined dump formats (so templight could be implemented as one). What do you think?
As long as it doesn't make Templight output any more difficult I have no objections :-) I don't know if Jason already started looking at what would be needed for Templight output, but he might have some suggestions.
Created attachment 38139 [details] Patch adding new flag in order to dump information about template instantiations. Hi, the attached patch adds a new compilation flag 'ftemplate-instantiations' in order to allow dumping debug information for template instantiations. This flag has 2 possible values: none(by default) and hreadable, that prints wich templates instantiations had been made in a human readable way. This patch was also made in order to add options easily and to interarct with plugins. For example in a plugin can be defined a derived class for template_instantiations_callbacks implementing _function_instantiation, _class_instantiation, _using_instantiation and then using add_template_instantiations_callbacks in order to access information about wich template instantiations had been made. This is an updated version. Changelog 2016-03-29 Andres Tiraboschi <andres.tiraboschi@tallertechnologies.com> * gcc/c-family/c.opt (ftemplate-instantiations): New flag. * gcc/flag-types.h (ti_dump_options): New type. * gcc/cp/decl2.c (cp_write_global_declarations): Added code to dump information. * gcc/cp/cp-tree.h (template_instantiations_callbacks): New type. (call_template_instantiation_callbacks): Declare. (add_template_instantiations_callbacks): Likewise. (clean_up_callbacks): Likewise. * gcc/cp/pt.c (human_readable_template_instantiations): New type. (instantiation_callbacks): Declare. (call_template_instantiation_callback): New function. (call_template_instantiation_callbacks): Likewise. (add_template_instantiations_callbacks): Likewise. (initialize_instantiations_callbacks): Likewise. (clean_up_callbacks): Likewise. (init_template_processing): Added code to initialize instatiation_callbacks. (register_specialization): Added code to dump information. * gcc/doc/invoke.texi (ftemplate-instantiations): Added documentation. Thanks.
I'm going to upload a new version for dumping dependencies quickly, so please ignore the current attachment.
Created attachment 38428 [details] Patch adding new flag in order to dump information about template instantiations. Changelog 2016-05-6 Andres Tiraboschi <andres.tiraboschi@tallertechnologies.com> * gcc/c-family/c.opt (ftemplate-instantiations): New flag. * gcc/flag-types.h (ti_dump_options): New type. * gcc/cp/decl2.c (cp_write_global_declarations): Added code to dump information. * gcc/cp/pt.h: New file. * gcc/cp/pt.h (template_instantiations_callbacks): New type. (dependence_tree): Likewise. (call_template_instantiation_callbacks): Declare. (add_template_instantiations_callbacks): Likewise. (clean_up_callbacks): Likewise. * gcc/cp/pt.c (human_readable_template_instantiations): New type. (instantiation_callbacks): Declare. (call_template_instantiation_callback): New function. (add_template_instantiations_callbacks): Likewise. (initialize_instantiations_callbacks): Likewise. (clean_up_callbacks): Likewise. (init_template_processing): Added code to initialize instatiation_callbacks. (register_specialization): Added code to dump information. (retrieve_specialization): Likewise. (lookup_template_class): Likewise. (lookup_template_function): Likewise. * gcc/doc/invoke.texi (ftemplate-instantiations): Added documentation. * gcc/cp/config-lang.in (gtfiles): Added \$(srcdir)/cp/pt.h * gcc/cp/Make-lang.in (CP_PLUGIN_HEADERS): Added pt.h. * gcc/cp/cp-lang.c: pt.h included.