diff options
| author | Owen Anderson <resistor@mac.com> | 2009-07-13 04:09:18 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-07-13 04:09:18 +0000 |
| commit | 53a52215b5480bd52f1aee5189c7b08a7098fc51 (patch) | |
| tree | 20cde4af23fe30f2b0cf520520affbb0c66a53ab /llvm/unittests/Support | |
| parent | 5302389442e928e7d8e9d07be1a4a463085d754a (diff) | |
| download | bcm5719-llvm-53a52215b5480bd52f1aee5189c7b08a7098fc51.tar.gz bcm5719-llvm-53a52215b5480bd52f1aee5189c7b08a7098fc51.zip | |
Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.
llvm-svn: 75445
Diffstat (limited to 'llvm/unittests/Support')
| -rw-r--r-- | llvm/unittests/Support/ValueHandleTest.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/unittests/Support/ValueHandleTest.cpp b/llvm/unittests/Support/ValueHandleTest.cpp index 336e7d90dc9..7a709427c96 100644 --- a/llvm/unittests/Support/ValueHandleTest.cpp +++ b/llvm/unittests/Support/ValueHandleTest.cpp @@ -284,14 +284,17 @@ TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) { public: int DeletedCalls; Value *AURWArgument; + LLVMContext *Context; - RecoveringVH() : DeletedCalls(0), AURWArgument(NULL) {} + RecoveringVH() : DeletedCalls(0), AURWArgument(NULL), + Context(&getGlobalContext()) {} RecoveringVH(Value *V) - : CallbackVH(V), DeletedCalls(0), AURWArgument(NULL) {} + : CallbackVH(V), DeletedCalls(0), AURWArgument(NULL), + Context(&getGlobalContext()) {} private: virtual void deleted() { - getValPtr()->replaceAllUsesWith(Constant::getNullValue(Type::Int32Ty)); + getValPtr()->replaceAllUsesWith(Context->getNullValue(Type::Int32Ty)); setValPtr(NULL); } virtual void allUsesReplacedWith(Value *new_value) { @@ -307,11 +310,13 @@ TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) { RecoveringVH RVH; RVH = BitcastV.get(); std::auto_ptr<BinaryOperator> BitcastUser( - BinaryOperator::CreateAdd(RVH, Constant::getNullValue(Type::Int32Ty))); + BinaryOperator::CreateAdd(RVH, + getGlobalContext().getNullValue(Type::Int32Ty))); EXPECT_EQ(BitcastV.get(), BitcastUser->getOperand(0)); BitcastV.reset(); // Would crash without the ValueHandler. - EXPECT_EQ(Constant::getNullValue(Type::Int32Ty), RVH.AURWArgument); - EXPECT_EQ(Constant::getNullValue(Type::Int32Ty), BitcastUser->getOperand(0)); + EXPECT_EQ(getGlobalContext().getNullValue(Type::Int32Ty), RVH.AURWArgument); + EXPECT_EQ(getGlobalContext().getNullValue(Type::Int32Ty), + BitcastUser->getOperand(0)); } } |

