aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-13 04:09:18 +0000
committerOwen Anderson <resistor@mac.com>2009-07-13 04:09:18 +0000
commit15b3932454f2777376ac500eae3999139a2c1f2e (patch)
tree89dc39f73d938c223b4e192bc6fd918490a60218 /unittests
parent08ee8812e70ea01e8e91ef4e9522ca877106f81c (diff)
downloadexternal_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.zip
external_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.tar.gz
external_llvm-15b3932454f2777376ac500eae3999139a2c1f2e.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ExecutionEngine/JIT/JITTest.cpp2
-rw-r--r--unittests/Support/ValueHandleTest.cpp17
2 files changed, 12 insertions, 7 deletions
diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp
index 87f3498..fce756b 100644
--- a/unittests/ExecutionEngine/JIT/JITTest.cpp
+++ b/unittests/ExecutionEngine/JIT/JITTest.cpp
@@ -73,7 +73,7 @@ TEST(JIT, GlobalInFunction) {
GTy,
false, // Not constant.
GlobalValue::InternalLinkage,
- Constant::getNullValue(GTy),
+ context.getNullValue(GTy),
"myglobal");
// Make a function that points to a global.
diff --git a/unittests/Support/ValueHandleTest.cpp b/unittests/Support/ValueHandleTest.cpp
index 336e7d9..7a70942 100644
--- a/unittests/Support/ValueHandleTest.cpp
+++ b/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));
}
}