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

Chris Lattner clattner at apple.com
Wed Oct 17 16:52:34 PDT 2007


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));
...

Reasonable?

-Chris



More information about the llvm-commits mailing list