add some WeakVH::operator='s. Without these, assigning
authorChris Lattner <sabre@nondot.org>
Sat, 10 Oct 2009 08:27:29 +0000 (08:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 10 Oct 2009 08:27:29 +0000 (08:27 +0000)
a Value* to a WeakVH was constructing a temporary WeakVH
(due to the implicit assignment operator).  This avoids
that cost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83704 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/ValueHandle.h

index d22b30af48911205bdd221964442adb865794d32..a8f2bdba552998ea43edbabd22c3a88114c56ce0 100644 (file)
@@ -54,6 +54,8 @@ private:
   PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
   ValueHandleBase *Next;
   Value *VP;
+  
+  explicit ValueHandleBase(const ValueHandleBase&); // DO NOT IMPLEMENT.
 public:
   explicit ValueHandleBase(HandleBaseKind Kind)
     : PrevPair(0, Kind), Next(0), VP(0) {}
@@ -131,6 +133,13 @@ public:
   WeakVH(const WeakVH &RHS)
     : ValueHandleBase(Weak, RHS) {}
 
+  Value *operator=(Value *RHS) {
+    return ValueHandleBase::operator=(RHS);
+  }
+  Value *operator=(const ValueHandleBase &RHS) {
+    return ValueHandleBase::operator=(RHS);
+  }
+
   operator Value*() const {
     return getValPtr();
   }