diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/SmallPtrSet.h | 6 |
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 |