[llvm-commits] [llvm] r43100 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

Ted Kremenek kremenek at apple.com
Wed Oct 17 17:26:36 PDT 2007


On Oct 17, 2007, at 4:52 PM, Chris Lattner wrote:

>
> On Oct 17, 2007, at 3:17 PM, Ted Kremenek wrote:
>
>>     assert (InsertPos != NULL);
>>
>> -    // FIXME: more intelligent calculation of alignment.
>> -    TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16);
>> -
>> +    // Allocate the new tree node and insert it into the cache.
>> +    TreeTy* T = Allocator.Allocate<TreeTy>();
>>     new (T) TreeTy(L,R,V,IncrementHeight(L,R));
>> -
>>     Cache.InsertNode(T,InsertPos);
>
> Random thought:  The allocator "Allocate" method returns a pointer to
> uninitialized memory.  Should'nt it return void *?  This would give  
> you:
>
> void *Tmp = Allocator.Allocate<TreeTy>();
> TreeTy *T = new (Tmp) TreeTy(L,R,V,IncrementHeight(L,R));
> ...
>

Yeah this is reasonable.  We should make people thing we're actually  
creating the object.




More information about the llvm-commits mailing list