[cfe-commits] r90306 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/TemplateName.h lib/AST/ASTContext.cpp lib/AST/TemplateName.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaTemplate.cpp

John McCall jmccall at apple.com
Wed Dec 2 11:22:07 PST 2009


On Dec 2, 2009, at 10:02 AM, Chris Lattner wrote:

> 
> On Dec 2, 2009, at 12:04 AM, John McCall wrote:
> 
>> Author: rjmccall
>> Date: Wed Dec  2 02:04:21 2009
>> New Revision: 90306
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=90306&view=rev
>> Log:
>> Push overloaded function templates through the parser using a totally different
>> leaked data structure than before.
> 
> 'leaked'?


In the lesser sense that the memory belongs to the ASTContext.  The problem is that we need to tell the parser that a TemplateTy actually refers to N overloaded function templates, and like all the other opaque types, it only allows a single pointer, so we need to allocate something to store them, even if temporary (or change the parser to store these differently, but that requires fussing with the token-annotation system &c.).  As it happens, an overloaded TemplateTy is going to be either (1) quickly consumed as an expression when the template arguments are parsed or (2) discarded as ill-formed in the current location.  In principle you could exploit that to avoid leaking the overload storage, but that's hard to make actually work;  either Sema would need to be told when the parser discards a TemplateTy (tough because of token annotations) or Sema would have to track it somehow (tough because you can have several in-flight at once).

John.



More information about the cfe-commits mailing list