Lines Matching +full:get +full:- +full:value
1 //===- ValueHandleTest.cpp - ValueHandle tests ----------------------------===//
8 //===----------------------------------------------------------------------===//
28 : ConstantV(ConstantInt::get(Type::getInt32Ty(Context), 0)), in ValueHandle()
34 ConcreteCallbackVH(Value *V) : CallbackVH(V) {} in ConcreteCallbackVH()
38 WeakVH WVH(BitcastV.get()); in TEST_F()
39 EXPECT_EQ(BitcastV.get(), WVH); in TEST_F()
43 // Make sure I can call a method on the underlying Value. It in TEST_F()
45 EXPECT_EQ(Type::getInt32Ty(Context), WVH->getType()); in TEST_F()
50 WeakVH BitcastWVH(BitcastV.get()); in TEST_F()
54 EXPECT_TRUE(BitcastV.get() == BitcastWVH); in TEST_F()
55 EXPECT_TRUE(BitcastWVH == BitcastV.get()); in TEST_F()
59 EXPECT_TRUE(BitcastV.get() != ConstantWVH); in TEST_F()
63 // Cast to Value* so comparisons work. in TEST_F()
64 Value *BV = BitcastV.get(); in TEST_F()
65 Value *CV = ConstantV; in TEST_F()
71 EXPECT_EQ(BV < CV, BitcastV.get() < ConstantWVH); in TEST_F()
72 EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantWVH); in TEST_F()
73 EXPECT_EQ(BV > CV, BitcastV.get() > ConstantWVH); in TEST_F()
74 EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantWVH); in TEST_F()
83 WeakVH WVH(BitcastV.get()); in TEST_F()
85 WeakVH WVH_Recreated(BitcastV.get()); in TEST_F()
86 BitcastV->replaceAllUsesWith(ConstantV); in TEST_F()
93 WeakVH WVH(BitcastV.get()); in TEST_F()
95 WeakVH WVH_Recreated(BitcastV.get()); in TEST_F()
97 Value *null_value = nullptr; in TEST_F()
105 AssertingVH<CastInst> AVH(BitcastV.get()); in TEST_F()
109 AssertingVH<Value> GenericAVH(BitcastV.get()); in TEST_F()
110 EXPECT_EQ(BitcastV.get(), GenericAVH); in TEST_F()
116 EXPECT_FALSE(AVH->mayWriteToMemory()); in TEST_F()
121 const CastInst *ConstBitcast = BitcastV.get(); in TEST_F()
128 AssertingVH<Value> BitcastAVH(BitcastV.get()); in TEST_F()
129 AssertingVH<Value> ConstantAVH(ConstantV); in TEST_F()
132 EXPECT_TRUE(BitcastV.get() == BitcastAVH); in TEST_F()
133 EXPECT_TRUE(BitcastAVH == BitcastV.get()); in TEST_F()
137 EXPECT_TRUE(BitcastV.get() != ConstantAVH); in TEST_F()
141 // Cast to Value* so comparisons work. in TEST_F()
142 Value *BV = BitcastV.get(); in TEST_F()
143 Value *CV = ConstantV; in TEST_F()
149 EXPECT_EQ(BV < CV, BitcastV.get() < ConstantAVH); in TEST_F()
150 EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantAVH); in TEST_F()
151 EXPECT_EQ(BV > CV, BitcastV.get() > ConstantAVH); in TEST_F()
152 EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantAVH); in TEST_F()
161 AssertingVH<Value> AVH(BitcastV.get()); in TEST_F()
162 BitcastV->replaceAllUsesWith(ConstantV); in TEST_F()
163 EXPECT_EQ(BitcastV.get(), AVH); in TEST_F()
177 AssertingVH<Value> AVH(BitcastV.get()); in TEST_F()
179 "An asserting value handle still pointed to this value!"); in TEST_F()
180 AssertingVH<Value> Copy(AVH); in TEST_F()
183 "An asserting value handle still pointed to this value!"); in TEST_F()
193 ConcreteCallbackVH CVH(BitcastV.get()); in TEST_F()
194 EXPECT_EQ(BitcastV.get(), CVH); in TEST_F()
198 // Make sure I can call a method on the underlying Value. It in TEST_F()
200 EXPECT_EQ(Type::getInt32Ty(Context), CVH->getType()); in TEST_F()
205 ConcreteCallbackVH BitcastCVH(BitcastV.get()); in TEST_F()
209 EXPECT_TRUE(BitcastV.get() == BitcastCVH); in TEST_F()
210 EXPECT_TRUE(BitcastCVH == BitcastV.get()); in TEST_F()
214 EXPECT_TRUE(BitcastV.get() != ConstantCVH); in TEST_F()
218 // Cast to Value* so comparisons work. in TEST_F()
219 Value *BV = BitcastV.get(); in TEST_F()
220 Value *CV = ConstantV; in TEST_F()
226 EXPECT_EQ(BV < CV, BitcastV.get() < ConstantCVH); in TEST_F()
227 EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantCVH); in TEST_F()
228 EXPECT_EQ(BV > CV, BitcastV.get() > ConstantCVH); in TEST_F()
229 EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantCVH); in TEST_F()
244 RecordingVH(Value *V) : CallbackVH(V), DeletedCalls(0), AURWCalls(0) {} in TEST_F()
251 void allUsesReplacedWith(Value *) override { AURWCalls++; } in TEST_F() argument
255 RVH = BitcastV.get(); in TEST_F()
267 Value *AURWArgument; in TEST_F()
270 RecordingVH(Value *V) in TEST_F()
278 void allUsesReplacedWith(Value *new_value) override { in TEST_F()
285 RVH = BitcastV.get(); in TEST_F()
288 BitcastV->replaceAllUsesWith(ConstantV); in TEST_F()
297 Value *AURWArgument; in TEST_F()
303 RecoveringVH(LLVMContext &TheContext, Value *V) in TEST_F()
309 getValPtr()->replaceAllUsesWith( in TEST_F()
313 void allUsesReplacedWith(Value *new_value) override { in TEST_F()
315 EXPECT_EQ(1U, getValPtr()->getNumUses()); in TEST_F()
321 // Normally, if a value has uses, deleting it will crash. However, we can use in TEST_F()
324 RVH = RecoveringVH(Context, BitcastV.get()); in TEST_F()
327 EXPECT_EQ(BitcastV.get(), BitcastUser->getOperand(0)); in TEST_F()
332 BitcastUser->getOperand(0)); in TEST_F()
337 // that shouldn't interfere with non-modified ValueHandles receiving in TEST_F()
347 DestroyingVH(Value *V) { in TEST_F()
357 void allUsesReplacedWith(Value *) override { in TEST_F() argument
364 WeakVH ShouldBeVisited1(BitcastV.get()); in TEST_F()
365 DestroyingVH C(BitcastV.get()); in TEST_F()
366 WeakVH ShouldBeVisited2(BitcastV.get()); in TEST_F()
368 BitcastV->replaceAllUsesWith(ConstantV); in TEST_F()
369 EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited1)); in TEST_F()
370 EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited2)); in TEST_F()
374 WeakVH ShouldBeVisited1(BitcastV.get()); in TEST_F()
375 DestroyingVH C(BitcastV.get()); in TEST_F()
376 WeakVH ShouldBeVisited2(BitcastV.get()); in TEST_F()
379 EXPECT_EQ(nullptr, static_cast<Value*>(ShouldBeVisited1)); in TEST_F()
380 EXPECT_EQ(nullptr, static_cast<Value*>(ShouldBeVisited2)); in TEST_F()
386 // Value deletion, the CallbackVH should get a chance to do so in TEST_F()
391 AssertingVH<Value> *ToClear[2]; in TEST_F()
392 ClearingVH(Value *V, in TEST_F()
393 AssertingVH<Value> &A0, AssertingVH<Value> &A1) in TEST_F()
406 AssertingVH<Value> A1, A2; in TEST_F()
407 A1 = BitcastV.get(); in TEST_F()
408 ClearingVH C(BitcastV.get(), A1, A2); in TEST_F()
409 A2 = BitcastV.get(); in TEST_F()