[llvm-commits] [llvm] r41831 - /llvm/trunk/include/llvm/ADT/DenseMap.h

Chris Lattner clattner at apple.com
Mon Sep 10 20:59:09 PDT 2007


>  private:
>    void CopyFrom(const DenseMap& other) {
> -    if (NumEntries != 0) {
> +    if (NumBuckets != 0 && !KeyInfoT::isPod()) {
...
> +    if (KeyInfoT::isPod())

Shouldn't this require that the key and value both be pod?

> +      memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof 
> (BucketT));
> +    else
> +      for (size_t i = 0; i < other.NumBuckets; ++i) {
> +        new (Buckets[i].first) KeyT(other.Buckets[i].first);
> +        new (Buckets[i].second) ValueT(other.Buckets[i].second);

This should not construct keys/values for buckets that are not valid.

-Chris






More information about the llvm-commits mailing list