diff options
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc')
4 files changed, 20 insertions, 20 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp index 38b60ea7fcd..ac847039d9f 100644 --- a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp @@ -17,7 +17,8 @@ using namespace llvm; namespace { TEST(IndirectionUtilsTest, MakeStub) { - ModuleBuilder MB(getGlobalContext(), "x86_64-apple-macosx10.10", ""); + LLVMContext Context; + ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", ""); Function *F = MB.createFunctionDecl<void(DummyStruct, DummyStruct)>(""); SmallVector<AttributeSet, 4> Attrs; Attrs.push_back( diff --git a/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp index a733bd558c8..89adb665f22 100644 --- a/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp @@ -25,6 +25,7 @@ namespace { class ObjectLinkingLayerExecutionTest : public testing::Test, public OrcExecutionTest { + }; class SectionMemoryManagerWrapper : public SectionMemoryManager { @@ -64,9 +65,10 @@ TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) { ObjectLinkingLayer<> ObjLayer; - auto M = llvm::make_unique<Module>("", getGlobalContext()); + LLVMContext Context; + auto M = llvm::make_unique<Module>("", Context); M->setTargetTriple("x86_64-unknown-linux-gnu"); - Type *Int32Ty = IntegerType::get(getGlobalContext(), 32); + Type *Int32Ty = IntegerType::get(Context, 32); GlobalVariable *GV = new GlobalVariable(*M, Int32Ty, false, GlobalValue::ExternalLinkage, ConstantInt::get(Int32Ty, 42), "foo"); @@ -131,14 +133,13 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { // instance (for Module 1) which is unsafe, as it will prevent relocation of // Module 2. - ModuleBuilder MB1(getGlobalContext(), "", "dummy"); + ModuleBuilder MB1(Context, "", "dummy"); { MB1.getModule()->setDataLayout(TM->createDataLayout()); Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("bar"); - BasicBlock *BarEntry = BasicBlock::Create(getGlobalContext(), "entry", - BarImpl); + BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl); IRBuilder<> Builder(BarEntry); - IntegerType *Int32Ty = IntegerType::get(getGlobalContext(), 32); + IntegerType *Int32Ty = IntegerType::get(Context, 32); Value *FourtyTwo = ConstantInt::getSigned(Int32Ty, 42); Builder.CreateRet(FourtyTwo); } @@ -147,13 +148,12 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { std::vector<object::ObjectFile*> Obj1Set; Obj1Set.push_back(Obj1.getBinary()); - ModuleBuilder MB2(getGlobalContext(), "", "dummy"); + ModuleBuilder MB2(Context, "", "dummy"); { MB2.getModule()->setDataLayout(TM->createDataLayout()); Function *BarDecl = MB2.createFunctionDecl<int32_t(void)>("bar"); Function *FooImpl = MB2.createFunctionDecl<int32_t(void)>("foo"); - BasicBlock *FooEntry = BasicBlock::Create(getGlobalContext(), "entry", - FooImpl); + BasicBlock *FooEntry = BasicBlock::Create(Context, "entry", FooImpl); IRBuilder<> Builder(FooEntry); Builder.CreateRet(Builder.CreateCall(BarDecl)); } @@ -203,14 +203,13 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) { // RuntimeDyld::MemoryManager::needsToReserveAllocationSpace hook, which is // called once per object before any sections are allocated. - ModuleBuilder MB1(getGlobalContext(), "", "dummy"); + ModuleBuilder MB1(Context, "", "dummy"); { MB1.getModule()->setDataLayout(TM->createDataLayout()); Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("foo"); - BasicBlock *BarEntry = BasicBlock::Create(getGlobalContext(), "entry", - BarImpl); + BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl); IRBuilder<> Builder(BarEntry); - IntegerType *Int32Ty = IntegerType::get(getGlobalContext(), 32); + IntegerType *Int32Ty = IntegerType::get(Context, 32); Value *FourtyTwo = ConstantInt::getSigned(Int32Ty, 42); Builder.CreateRet(FourtyTwo); } @@ -219,14 +218,13 @@ TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) { std::vector<object::ObjectFile*> Obj1Set; Obj1Set.push_back(Obj1.getBinary()); - ModuleBuilder MB2(getGlobalContext(), "", "dummy"); + ModuleBuilder MB2(Context, "", "dummy"); { MB2.getModule()->setDataLayout(TM->createDataLayout()); Function *BarImpl = MB2.createFunctionDecl<int32_t(void)>("bar"); - BasicBlock *BarEntry = BasicBlock::Create(getGlobalContext(), "entry", - BarImpl); + BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl); IRBuilder<> Builder(BarEntry); - IntegerType *Int32Ty = IntegerType::get(getGlobalContext(), 32); + IntegerType *Int32Ty = IntegerType::get(Context, 32); Value *Seven = ConstantInt::getSigned(Int32Ty, 7); Builder.CreateRet(Seven); } diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp index 776d26970a3..305325b6c6e 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -25,11 +25,11 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef) class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest { protected: std::unique_ptr<Module> createTestModule(const Triple &TT) { - ModuleBuilder MB(getGlobalContext(), TT.str(), ""); + ModuleBuilder MB(Context, TT.str(), ""); Function *TestFunc = MB.createFunctionDecl<int()>("testFunc"); Function *Main = MB.createFunctionDecl<int(int, char*[])>("main"); - Main->getBasicBlockList().push_back(BasicBlock::Create(getGlobalContext())); + Main->getBasicBlockList().push_back(BasicBlock::Create(Context)); IRBuilder<> B(&Main->back()); Value* Result = B.CreateCall(TestFunc); B.CreateRet(Result); diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h index e8fab561564..fe3da88dc9d 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -54,6 +54,7 @@ public: }; protected: + LLVMContext Context; std::unique_ptr<TargetMachine> TM; private: static bool NativeTargetInitialized; |