[cfe-commits] r101194 - /cfe/trunk/include/clang/AST/ASTVector.h

Ted Kremenek kremenek at apple.com
Wed Apr 14 00:00:54 PDT 2010


On Apr 13, 2010, at 8:39 PM, Chris Lattner wrote:

> 
> On Apr 13, 2010, at 4:39 PM, Ted Kremenek wrote:
> 
>> Author: kremenek
>> Date: Tue Apr 13 18:39:09 2010
>> New Revision: 101194
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=101194&view=rev
>> Log:
>> Introduce ASTVector, which is a std::vector-like class that allocates all memory
>> using the allocator associated with an ASTContext.  This is largely copy-and-paste
>> from SmallVector, and should be refactored one day.
> 
> It shouldn't be too hard to make SmallVector use an Allocator, would it?

No; I think this class is evidence of that, since it's largely the same logic.

I think the trick would be in keeping the allocator argument optional if one could specify a default allocator (e.g., a MallocAllocator) so that existing SmallVector clients wouldn't be forced to change.  I don't think it would be too difficult.

My main intent of doing 'ASTVector' first was to try the idea out, see that there was no fallout, and then do the refactoring.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100414/dc996766/attachment.html>


More information about the cfe-commits mailing list