summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/SmallPtrSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/SmallPtrSet.h')
-rw-r--r--include/llvm/ADT/SmallPtrSet.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/ADT/SmallPtrSet.h b/include/llvm/ADT/SmallPtrSet.h
index c7f5e5bfc0..b52aebf7d5 100644
--- a/include/llvm/ADT/SmallPtrSet.h
+++ b/include/llvm/ADT/SmallPtrSet.h
@@ -293,14 +293,16 @@ public:
SmallPtrSet<PtrType, SmallSize> &
operator=(const SmallPtrSet<PtrType, SmallSize> &RHS) {
- CopyFrom(RHS);
+ if (&RHS != this)
+ CopyFrom(RHS);
return *this;
}
#if LLVM_HAS_RVALUE_REFERENCES
SmallPtrSet<PtrType, SmallSize>&
operator=(SmallPtrSet<PtrType, SmallSize> &&RHS) {
- MoveFrom(SmallSizePowTwo, std::move(RHS));
+ if (&RHS != this)
+ MoveFrom(SmallSizePowTwo, std::move(RHS));
return *this;
}
#endif