[cfe-dev] some notes about templates

Nick Lewycky nlewycky at google.com
Sat Jun 29 11:59:30 PDT 2013


On 29 June 2013 11:00, Larry Evans <cppljevans at suddenlink.net> wrote:

> On 06/28/13 19:07, Nick Lewycky wrote:
> [snip]
> > ActiveTemplateInstantiations shouldn't be a SmallVector in Sema, they
> > should be allocated by a BumpPtrAllocator in ASTContext. Then we can put
> > ActiveTemplateInstantions in the AST, which will requiring changing it a
> > bit (no pointers to sema:: objects), but we also want to add a template
> > depth, correct point-of-instantiation SourceLocation and add missing
> > instantiation records (such as instantiation due to overload
> > resolution). An awesome outcome of this will be that we'll be able to
> > produce template stack traces even when we aren't actively doing
> > template instantiation. That would in turn allow us to do other things
> > like flatten instantiation instead of making it recursive.
> >
> Would this flattening speed compile times?  Long compile times
> is one strong reason why boost preprocessor is used to implement tuples:
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/235386
>

Not really, maybe only a tiny bit. What it means is that the depth of
templates we can instantiate wouldn't be limited by our stack space, but by
heap space.

I would be very surprised if clang has bad compile-time performance
building tuples. Without thinking about it too hard, this sounds like
something we should already be good at.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130629/ba2a8ce1/attachment.html>


More information about the cfe-dev mailing list