[llvm-commits] [llvm] r38470 - in /llvm/trunk: include/llvm/ADT/SmallPtrSet.h lib/Support/SmallPtrSet.cpp

Owen Anderson resistor at mac.com
Mon Jul 9 13:59:01 PDT 2007


Author: resistor
Date: Mon Jul  9 15:59:01 2007
New Revision: 38470

URL: http://llvm.org/viewvc/llvm-project?rev=38470&view=rev
Log:
Make the assignment operator for SmallPtrSet return a reference, and fix a long-standing bug in the copy
ctor while I'm at it.

Thanks to Chris Lattner for help with this patch.

Modified:
    llvm/trunk/include/llvm/ADT/SmallPtrSet.h
    llvm/trunk/lib/Support/SmallPtrSet.cpp

Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=38470&r1=38469&r2=38470&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Mon Jul  9 15:59:01 2007
@@ -240,7 +240,7 @@
   
   // Allow assignment from any smallptrset with the same element type even if it
   // doesn't have the same smallsize.
-  const SmallPtrSet<PtrType, SmallSize>
+  const SmallPtrSet<PtrType, SmallSize>&
   operator=(const SmallPtrSet<PtrType, SmallSize> &RHS) {
     CopyFrom(RHS);
     return *this;

Modified: llvm/trunk/lib/Support/SmallPtrSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SmallPtrSet.cpp?rev=38470&r1=38469&r2=38470&view=diff

==============================================================================
--- llvm/trunk/lib/Support/SmallPtrSet.cpp (original)
+++ llvm/trunk/lib/Support/SmallPtrSet.cpp Mon Jul  9 15:59:01 2007
@@ -164,7 +164,7 @@
     CurArray[CurArraySize] = 0;
 
     // Copy over all valid entries.
-    for (void **BucketPtr = that.CurArray, **E = that.CurArray+CurArraySize;
+    for (void **BucketPtr = that.CurArray, **E = that.CurArray+that.CurArraySize;
          BucketPtr != E; ++BucketPtr) {
       // Copy over the element if it is valid.
       void *Elt = *BucketPtr;





More information about the llvm-commits mailing list