//===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
struct ValueHolder : public User {
ValueHolder(Value *V = 0);
- ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}
+ ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {
+ Operands.push_back(Use(VH.get(), this));
+ }
// Getters...
- const Value *get() const { return getOperand(0); }
- operator const Value*() const { return getOperand(0); }
- Value *get() { return getOperand(0); }
- operator Value*() { return getOperand(0); }
+ Value *get() const { return (Value*)getOperand(0); }
+ operator Value*() const { return (Value*)getOperand(0); }
// Setters...
const ValueHolder &operator=(Value *V) {