@@ -34,11 +34,7 @@ class ValueHandleBase {
34
34
// /
35
35
// / This is to avoid having a vtable for the light-weight handle pointers. The
36
36
// / fully general Callback version does have a vtable.
37
- enum HandleBaseKind {
38
- Assert,
39
- Callback,
40
- Weak
41
- };
37
+ enum HandleBaseKind { Assert, Callback, WeakTracking };
42
38
43
39
ValueHandleBase (const ValueHandleBase &RHS)
44
40
: ValueHandleBase(RHS.PrevPair.getInt(), RHS) {}
@@ -145,14 +141,14 @@ class ValueHandleBase {
145
141
// / is useful for advisory sorts of information, but should not be used as the
146
142
// / key of a map (since the map would have to rearrange itself when the pointer
147
143
// / changes).
148
- class WeakVH : public ValueHandleBase {
144
+ class WeakTrackingVH : public ValueHandleBase {
149
145
public:
150
- WeakVH () : ValueHandleBase(Weak ) {}
151
- WeakVH (Value *P) : ValueHandleBase(Weak , P) {}
152
- WeakVH (const WeakVH &RHS)
153
- : ValueHandleBase(Weak , RHS) {}
146
+ WeakTrackingVH () : ValueHandleBase(WeakTracking ) {}
147
+ WeakTrackingVH (Value *P) : ValueHandleBase(WeakTracking , P) {}
148
+ WeakTrackingVH (const WeakTrackingVH &RHS)
149
+ : ValueHandleBase(WeakTracking , RHS) {}
154
150
155
- WeakVH &operator =(const WeakVH &RHS) = default ;
151
+ WeakTrackingVH &operator =(const WeakTrackingVH &RHS) = default ;
156
152
157
153
Value *operator =(Value *RHS) {
158
154
return ValueHandleBase::operator =(RHS);
@@ -170,15 +166,17 @@ class WeakVH : public ValueHandleBase {
170
166
}
171
167
};
172
168
173
- // Specialize simplify_type to allow WeakVH to participate in
169
+ // Specialize simplify_type to allow WeakTrackingVH to participate in
174
170
// dyn_cast, isa, etc.
175
- template <> struct simplify_type <WeakVH > {
171
+ template <> struct simplify_type <WeakTrackingVH > {
176
172
typedef Value *SimpleType;
177
- static SimpleType getSimplifiedValue (WeakVH &WVH) { return WVH; }
173
+ static SimpleType getSimplifiedValue (WeakTrackingVH &WVH) { return WVH; }
178
174
};
179
- template <> struct simplify_type <const WeakVH > {
175
+ template <> struct simplify_type <const WeakTrackingVH > {
180
176
typedef Value *SimpleType;
181
- static SimpleType getSimplifiedValue (const WeakVH &WVH) { return WVH; }
177
+ static SimpleType getSimplifiedValue (const WeakTrackingVH &WVH) {
178
+ return WVH;
179
+ }
182
180
};
183
181
184
182
// / \brief Value handle that asserts if the Value is deleted.
@@ -294,7 +292,7 @@ struct isPodLike<AssertingVH<T> > {
294
292
// / Assigning a value to a TrackingVH is always allowed, even if said TrackingVH
295
293
// / no longer points to a valid value.
296
294
template <typename ValueTy> class TrackingVH {
297
- WeakVH InnerHandle;
295
+ WeakTrackingVH InnerHandle;
298
296
299
297
public:
300
298
ValueTy *getValPtr () const {
@@ -368,7 +366,8 @@ class CallbackVH : public ValueHandleBase {
368
366
// /
369
367
// / Called when this->getValPtr() is destroyed, inside ~Value(), so you
370
368
// / may call any non-virtual Value method on getValPtr(), but no subclass
371
- // / methods. If WeakVH were implemented as a CallbackVH, it would use this
369
+ // / methods. If WeakTrackingVH were implemented as a CallbackVH, it would use
370
+ // / this
372
371
// / method to call setValPtr(NULL). AssertingVH would use this method to
373
372
// / cause an assertion failure.
374
373
// /
@@ -379,7 +378,8 @@ class CallbackVH : public ValueHandleBase {
379
378
// / \brief Callback for Value RAUW.
380
379
// /
381
380
// / Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
382
- // / _before_ any of the uses have actually been replaced. If WeakVH were
381
+ // / _before_ any of the uses have actually been replaced. If WeakTrackingVH
382
+ // / were
383
383
// / implemented as a CallbackVH, it would use this method to call
384
384
// / setValPtr(new_value). AssertingVH would do nothing in this method.
385
385
virtual void allUsesReplacedWith (Value *) {}
0 commit comments