diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-04-26 16:20:59 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-04-26 16:20:59 +0000 |
commit | 7de051ba0c4632dc5fcabc4f17cdf0cedf97724e (patch) | |
tree | 0ebb49094b5c389a8028fb5ef8e34cca64b7e36b /llvm/lib/IR | |
parent | 01de5577388a02ea289b5517d55dc0e8eb4efc76 (diff) | |
download | bcm5719-llvm-7de051ba0c4632dc5fcabc4f17cdf0cedf97724e.tar.gz bcm5719-llvm-7de051ba0c4632dc5fcabc4f17cdf0cedf97724e.zip |
Add a new WeakVH value handle; NFC
Summary:
WeakVH nulls itself out if the value it was tracking gets deleted, but
it does not track RAUW.
Reviewers: dblaikie, davide
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D32267
llvm-svn: 301425
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 23a0f7a2601..18e44dcd352 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -825,8 +825,10 @@ void ValueHandleBase::ValueIsDeleted(Value *V) { // pointer. Entry->operator=(DenseMapInfo<Value *>::getTombstoneKey()); break; + case Weak: case WeakTracking: - // WeakTracking just goes to null, which will unlink it from the list. + // WeakTracking and Weak just go to null, which unlinks them + // from the list. Entry->operator=(nullptr); break; case Callback: @@ -874,7 +876,8 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) { switch (Entry->getKind()) { case Assert: - // Asserting handle does not follow RAUW implicitly. + case Weak: + // Asserting and Weak handles do not follow RAUW implicitly. break; case Tracking: // Tracking goes to new value like a WeakTrackingVH. Note that this may |