Make the assignment operator for SmallPtrSet return a reference, and fix a long-stand...
authorOwen Anderson <resistor@mac.com>
Mon, 9 Jul 2007 20:59:01 +0000 (20:59 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 9 Jul 2007 20:59:01 +0000 (20:59 +0000)
ctor while I'm at it.

Thanks to Chris Lattner for help with this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38470 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallPtrSet.h
lib/Support/SmallPtrSet.cpp

index 2563982f514b21d1924ecd721b1aa4dc96a2fe6a..9f975af07c56b2a62a7dc6de9dada70c17e6255e 100644 (file)
@@ -240,7 +240,7 @@ public:
   
   // 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;
index 5ad243033fcf37e71e7d938865f2e3b8b606d5a0..e8e530fceedb33a2271e5db7ec1a6dfda1823b9f 100644 (file)
@@ -164,7 +164,7 @@ SmallPtrSetImpl::SmallPtrSetImpl(const SmallPtrSetImpl& that) {
     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;