[ADT] Increment epoch from DenseMap::swap.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 2 Apr 2015 04:58:12 +0000 (04:58 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 2 Apr 2015 04:58:12 +0000 (04:58 +0000)
Swapping DenseMap A with DenseMap B invalidates iterators pointing into
both A and B.

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

include/llvm/ADT/DenseMap.h

index 443a620d1af0a44396ce0fd3744bb56758bfc0bd..7bfa8b22f7a3a40dde86d50ae15276e14e4faa3d 100644 (file)
@@ -584,6 +584,8 @@ public:
   }
 
   void swap(DenseMap& RHS) {
+    this->incrementEpoch();
+    RHS.incrementEpoch();
     std::swap(Buckets, RHS.Buckets);
     std::swap(NumEntries, RHS.NumEntries);
     std::swap(NumTombstones, RHS.NumTombstones);