aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-07-24 12:09:22 +0000
committerDuncan Sands <baldrick@free.fr>2010-07-24 12:09:22 +0000
commitffe8c8871a1c7119440b2b02dce746901794fa5e (patch)
tree4a272cc44b65ffdb271d211a0e4b9bdb22fb4025 /lib
parentf28dd8861190df4926cdc66201a39a6af950d564 (diff)
downloadexternal_llvm-ffe8c8871a1c7119440b2b02dce746901794fa5e.zip
external_llvm-ffe8c8871a1c7119440b2b02dce746901794fa5e.tar.gz
external_llvm-ffe8c8871a1c7119440b2b02dce746901794fa5e.tar.bz2
Clarify that if a new value handle is added while dropping value handles
hanging off a value, then the dropping code will intentionally not drop it too (since this is almost certainly a bug). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Value.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 487196c..436a07c 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -488,10 +488,15 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
ValueHandleBase *Entry = pImpl->ValueHandles[V];
assert(Entry && "Value bit set but no entries exist");
- // We use a local ValueHandleBase as an iterator so that
- // ValueHandles can add and remove themselves from the list without
- // breaking our iteration. This is not really an AssertingVH; we
- // just have to give ValueHandleBase some kind.
+ // We use a local ValueHandleBase as an iterator so that ValueHandles can add
+ // and remove themselves from the list without breaking our iteration. This
+ // is not really an AssertingVH; we just have to give ValueHandleBase a kind.
+ // 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
+ // 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) {
Iterator.RemoveFromUseList();
Iterator.AddToExistingUseListAfter(Entry);