diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2017-12-11 19:22:59 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2017-12-11 19:22:59 +0000 |
commit | 1559083a44c32e2d1a70ef9bc5a4942414b4469a (patch) | |
tree | e55381c3e259443ab90c8c15ff82dd0cf1897397 /include | |
parent | 1bc958a4c171fa30abf017afe532dc93e21feb97 (diff) |
Ensure moved-from container is cleared on move
In all cases except for this optimistic attempt to reuse memory, the
moved-from TinyPtrVector was left `empty()` at the end of this
assignment. Though using a container after it's been moved from can be a
bit sketchy, it's probably best to just be consistent here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/TinyPtrVector.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/llvm/ADT/TinyPtrVector.h b/include/llvm/ADT/TinyPtrVector.h index 79740713f75..73573d65e2b 100644 --- a/include/llvm/ADT/TinyPtrVector.h +++ b/include/llvm/ADT/TinyPtrVector.h @@ -97,6 +97,7 @@ public: if (RHS.Val.template is<EltTy>()) { V->clear(); V->push_back(RHS.front()); + RHS.Val = (EltTy)nullptr; return *this; } delete V; |