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
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 23a0f7a..18e44dc 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -825,8 +825,10 @@
// 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 @@
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