@@ -45,7 +45,7 @@ class ValueHandleBase {
4545 // /
4646 // / This is to avoid having a vtable for the light-weight handle pointers. The
4747 // / fully general Callback version does have a vtable.
48- enum HandleBaseKind { Assert, Callback, Weak };
48+ enum HandleBaseKind { Assert, Callback, WeakTracking };
4949
5050private:
5151 PointerIntPair<ValueHandleBase**, 2 , HandleBaseKind> PrevPair;
@@ -141,14 +141,14 @@ class ValueHandleBase {
141141// / is useful for advisory sorts of information, but should not be used as the
142142// / key of a map (since the map would have to rearrange itself when the pointer
143143// / changes).
144- class WeakVH : public ValueHandleBase {
144+ class WeakTrackingVH : public ValueHandleBase {
145145public:
146- WeakVH () : ValueHandleBase(Weak ) {}
147- WeakVH (Value *P) : ValueHandleBase(Weak , P) {}
148- WeakVH (const WeakVH &RHS)
149- : ValueHandleBase(Weak , RHS) {}
146+ WeakTrackingVH () : ValueHandleBase(WeakTracking ) {}
147+ WeakTrackingVH (Value *P) : ValueHandleBase(WeakTracking , P) {}
148+ WeakTrackingVH (const WeakTrackingVH &RHS)
149+ : ValueHandleBase(WeakTracking , RHS) {}
150150
151- WeakVH &operator =(const WeakVH &RHS) = default ;
151+ WeakTrackingVH &operator =(const WeakTrackingVH &RHS) = default ;
152152
153153 Value *operator =(Value *RHS) {
154154 return ValueHandleBase::operator =(RHS);
@@ -166,15 +166,17 @@ class WeakVH : public ValueHandleBase {
166166 }
167167};
168168
169- // Specialize simplify_type to allow WeakVH to participate in
169+ // Specialize simplify_type to allow WeakTrackingVH to participate in
170170// dyn_cast, isa, etc.
171- template <> struct simplify_type <WeakVH > {
171+ template <> struct simplify_type <WeakTrackingVH > {
172172 typedef Value *SimpleType;
173- static SimpleType getSimplifiedValue (WeakVH &WVH) { return WVH; }
173+ static SimpleType getSimplifiedValue (WeakTrackingVH &WVH) { return WVH; }
174174};
175- template <> struct simplify_type <const WeakVH > {
175+ template <> struct simplify_type <const WeakTrackingVH > {
176176 typedef Value *SimpleType;
177- static SimpleType getSimplifiedValue (const WeakVH &WVH) { return WVH; }
177+ static SimpleType getSimplifiedValue (const WeakTrackingVH &WVH) {
178+ return WVH;
179+ }
178180};
179181
180182// / \brief Value handle that asserts if the Value is deleted.
@@ -291,7 +293,7 @@ struct isPodLike<AssertingVH<T> > {
291293// / Assigning a value to a TrackingVH is always allowed, even if said TrackingVH
292294// / no longer points to a valid value.
293295template <typename ValueTy> class TrackingVH {
294- WeakVH InnerHandle;
296+ WeakTrackingVH InnerHandle;
295297
296298public:
297299 ValueTy *getValPtr () const {
@@ -396,7 +398,8 @@ class CallbackVH : public ValueHandleBase {
396398 // /
397399 // / Called when this->getValPtr() is destroyed, inside ~Value(), so you
398400 // / may call any non-virtual Value method on getValPtr(), but no subclass
399- // / methods. If WeakVH were implemented as a CallbackVH, it would use this
401+ // / methods. If WeakTrackingVH were implemented as a CallbackVH, it would use
402+ // / this
400403 // / method to call setValPtr(NULL). AssertingVH would use this method to
401404 // / cause an assertion failure.
402405 // /
@@ -407,7 +410,8 @@ class CallbackVH : public ValueHandleBase {
407410 // / \brief Callback for Value RAUW.
408411 // /
409412 // / Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
410- // / _before_ any of the uses have actually been replaced. If WeakVH were
413+ // / _before_ any of the uses have actually been replaced. If WeakTrackingVH
414+ // / were
411415 // / implemented as a CallbackVH, it would use this method to call
412416 // / setValPtr(new_value). AssertingVH would do nothing in this method.
413417 virtual void allUsesReplacedWith (Value *) {}
0 commit comments