aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-02 21:10:48 +0000
committerDan Gohman <gohman@apple.com>2009-05-02 21:10:48 +0000
commitc09b12c62208f09de9d107b320f5420ae6e4fc38 (patch)
treef6751e459b0d08676798384a220ebba5b6461a88 /lib/VMCore/Value.cpp
parent42da7f754235a85d2334760212cf69400c439dd2 (diff)
Apply Jeffrey Yasskin's CallbackVH patch, with minor tweaks from me
to make the copy constructor and destructor protected, and corresponding adjustments to the unittests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r--lib/VMCore/Value.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index af3f4e7078..35c8ccfae6 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -511,7 +511,9 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
ThisNode->operator=(0);
break;
case Callback:
- assert(0 && "Callback not implemented yet!");
+ // Forward to the subclass's implementation.
+ static_cast<CallbackVH*>(ThisNode)->deleted();
+ break;
}
}
@@ -543,11 +545,17 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
ThisNode->operator=(New);
break;
case Callback:
- assert(0 && "Callback not implemented yet!");
+ // Forward to the subclass's implementation.
+ static_cast<CallbackVH*>(ThisNode)->allUsesReplacedWith(New);
+ break;
}
}
}
+/// ~CallbackVH. Empty, but defined here to avoid emitting the vtable
+/// more than once.
+CallbackVH::~CallbackVH() {}
+
//===----------------------------------------------------------------------===//
// User Class