summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-07-27 06:53:14 +0000
committerDuncan Sands <baldrick@free.fr>2010-07-27 06:53:14 +0000
commitfd5c8329cf7eef9cc0eb1fad253a5f2d53d12ee9 (patch)
tree6464f8bc250ff83ea217c8d5607085240cb22483 /llvm/lib/VMCore/Value.cpp
parentf8270bdb2d0465dd9ac4f33357d369eddd572a73 (diff)
downloadbcm5719-llvm-fd5c8329cf7eef9cc0eb1fad253a5f2d53d12ee9.tar.gz
bcm5719-llvm-fd5c8329cf7eef9cc0eb1fad253a5f2d53d12ee9.zip
After updating value handles for RAUW, check that no weak or tracking handles
are still on the list. This might happen if a CallbackVH created some new value handles for the old value when doing RAUW. Barf if it occurs, since it is almost certainly a mistake. llvm-svn: 109495
Diffstat (limited to 'llvm/lib/VMCore/Value.cpp')
-rw-r--r--llvm/lib/VMCore/Value.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index 436a07c4f20..b8c67756546 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -494,7 +494,7 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
// Note that we deliberately do not the support the case when dropping a value
// handle results in a new value handle being permanently added to the list
// (as might occur in theory for CallbackVH's): the new value handle will not
- // be processed and the checking code will meet out righteous punishment if
+ // be processed and the checking code will mete out righteous punishment if
// the handle is still present once we have finished processing all the other
// value handles (it is fine to momentarily add then remove a value handle).
for (ValueHandleBase Iterator(Assert, *Entry); Entry; Entry = Iterator.Next) {
@@ -577,6 +577,24 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
break;
}
}
+
+#ifndef NDEBUG
+ // If any new tracking or weak value handles were added while processing the
+ // list, then complain about it now.
+ if (Old->HasValueHandle)
+ for (Entry = pImpl->ValueHandles[Old]; Entry; Entry = Entry->Next)
+ switch (Entry->getKind()) {
+ case Tracking:
+ case Weak:
+ dbgs() << "After RAUW from " << *Old->getType() << " %"
+ << Old->getNameStr() << " to " << *New->getType() << " %"
+ << New->getNameStr() << "\n";
+ llvm_unreachable("A tracking or weak value handle still pointed to the"
+ " old value!\n");
+ default:
+ break;
+ }
+#endif
}
/// ~CallbackVH. Empty, but defined here to avoid emitting the vtable
OpenPOWER on IntegriCloud