[cfe-dev] [Templight] Templight "v2" with gdb-style debugger

Porkolab Zoltan gsd at caesar.elte.hu
Tue Jan 6 13:09:33 PST 2015


Hi all,

First of all, Nick: many thanks for helping us. Mikael did a huge work 
refactoring templight and now there are even clients eager to use it:
https://github.com/sabel83/metashell

On Tue, 6 Jan 2015, Nick Lewycky wrote:

> On 11 March 2014 18:28, Mikael Persson <mikael.s.persson at gmail.com> wrote:
> 
> Hi Mikael,
> 
> Sorry to lead with this, but it's important. The llvm project requires that
> patches be submitted by their author (or authors). If you grabbed the
> original templight code and refactored it, then it may be coauthored between
> you and the original authors. Our policy requires that an author submit
> their own code, not mail in someone else's,
> see http://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes for
> specifics.

We completely support Mikael's work on refactoring the original templight. 
Naturally, we happy to adopt Mikael as a co-author or give him any kind of
authorization to submit this patch.

>       Changes to existing Clang code-base:
>

[...]

>  (5) Added callbacks for begin / end of template instantiations. These
> were added in all the places where the original Templight code had
> templight calls. This replaces the original templight tracing calls.
> 
> 
> At a high level, I think that what we currently do in Sema by tracking
> template instantiations as a stack (Sema::ActiveTemplateInstantiations)
> should be available in the AST after instantiation is complete. Then we
> could query the AST to ask why something was instantiated instead of tracing
> the act of instantiation. Is there any use case for templight where this
> wouldn't work?

Don't forget, this is a template debugger and profiler function.

As a debugger we want to follow the chain of template related events even 
if the instantiation was not successfully finished. Unpaired begin-end 
instantiation events may happen and are reported in templight. Moreover, 
this strategy allows templight to work in "safe mode": emitting events 
immediatelly as they happened. This way we have the last events even if 
the compiler crashes - which unfortunatelly may happen for template 
metaprograms.

As a profiler templight assigns timestamps for beginning/end events to 
measure the time clang has spent on that instantiation.

Thanks again helping us,

Zoltan


More information about the cfe-dev mailing list