summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-09 20:59:01 +0000
committerOwen Anderson <resistor@mac.com>2007-07-09 20:59:01 +0000
commit3364abbb36ea666ef72351bec890064ab1ed063f (patch)
treea39aaf4f5506829e2d34f16d4ea659c958eae687
parent94d0fbe1a600aa50814a2b05dbe5ae0c53b20cc7 (diff)
downloadbcm5719-llvm-3364abbb36ea666ef72351bec890064ab1ed063f.tar.gz
bcm5719-llvm-3364abbb36ea666ef72351bec890064ab1ed063f.zip
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. llvm-svn: 38470
-rw-r--r--llvm/include/llvm/ADT/SmallPtrSet.h2
-rw-r--r--llvm/lib/Support/SmallPtrSet.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h
index 2563982f514..9f975af07c5 100644
--- a/llvm/include/llvm/ADT/SmallPtrSet.h
+++ b/llvm/include/llvm/ADT/SmallPtrSet.h
@@ -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;
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp
index 5ad243033fc..e8e530fceed 100644
--- a/llvm/lib/Support/SmallPtrSet.cpp
+++ b/llvm/lib/Support/SmallPtrSet.cpp
@@ -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;
OpenPOWER on IntegriCloud