Remove every uses of getGlobalContext() in LLVM (but the C API)
At the same time, fixes InstructionsTest::CastInst unittest: yes
you can leave the IR in an invalid state and exit when you don't
destroy the context (like the global one), no longer now.
This is the first part of http://reviews.llvm.org/D19094
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266379
diff --git a/llvm/unittests/IR/ValueMapTest.cpp b/llvm/unittests/IR/ValueMapTest.cpp
index 71a1fd1..28633b4 100644
--- a/llvm/unittests/IR/ValueMapTest.cpp
+++ b/llvm/unittests/IR/ValueMapTest.cpp
@@ -22,15 +22,15 @@
template<typename T>
class ValueMapTest : public testing::Test {
protected:
+ LLVMContext Context;
Constant *ConstantV;
std::unique_ptr<BitCastInst> BitcastV;
std::unique_ptr<BinaryOperator> AddV;
- ValueMapTest() :
- ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
- BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))),
- AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) {
- }
+ ValueMapTest()
+ : ConstantV(ConstantInt::get(Type::getInt32Ty(Context), 0)),
+ BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(Context))),
+ AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) {}
};
// Run everything on Value*, a subtype to make sure that casting works as