summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-23 19:43:16 +0000
committerChris Lattner <sabre@nondot.org>2003-08-23 19:43:16 +0000
commitf7c4acef9915073388ec5cc36bc14fdb32def551 (patch)
tree1f7f875611d1923cd0c58271cdef40de5ca60153 /lib/Support
parent59bc1a7ad33b29800529cbf289705c6f1ef3c317 (diff)
downloadllvm-f7c4acef9915073388ec5cc36bc14fdb32def551.tar.gz
llvm-f7c4acef9915073388ec5cc36bc14fdb32def551.tar.bz2
llvm-f7c4acef9915073388ec5cc36bc14fdb32def551.tar.xz
Initial checkin of ValueHolder helper
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/ValueHolder.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Support/ValueHolder.cpp b/lib/Support/ValueHolder.cpp
new file mode 100644
index 0000000000..e0806b538a
--- /dev/null
+++ b/lib/Support/ValueHolder.cpp
@@ -0,0 +1,16 @@
+//===-- ValueHolder.cpp - Wrapper for Value implementation ----------------===//
+//
+// This class defines a simple subclass of User, which keeps a pointer to a
+// Value, which automatically updates when Value::replaceAllUsesWith is called.
+// This is useful when you have pointers to Value's in your pass, but the
+// pointers get invalidated when some other portion of the algorithm is
+// replacing Values with other Values.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/ValueHolder.h"
+#include "llvm/Type.h"
+
+ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) {
+ Operands.push_back(Use(V, this));
+}