diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-04-29 15:52:27 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-04-29 15:52:27 +0000 |
commit | 13085edf46866b2e036bebb7ef94b9fe53569265 (patch) | |
tree | 3535943eaec5fe44466f54bede4693ce3eb31659 /unittests/Linker | |
parent | e26c8c2d8260447058379a9cdd11757d9e440573 (diff) |
LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). The global context might not be free'd. [vg_leak]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Linker')
-rw-r--r-- | unittests/Linker/LinkModulesTest.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/unittests/Linker/LinkModulesTest.cpp b/unittests/Linker/LinkModulesTest.cpp index 7b40b9f6721..ab383b464ca 100644 --- a/unittests/Linker/LinkModulesTest.cpp +++ b/unittests/Linker/LinkModulesTest.cpp @@ -22,7 +22,6 @@ namespace { class LinkModuleTest : public testing::Test { protected: virtual void SetUp() { - LLVMContext &Ctx = getGlobalContext(); M.reset(new Module("MyModule", Ctx)); FunctionType *FTy = FunctionType::get(Type::getInt8PtrTy(Ctx), Type::getInt32Ty(Ctx), @@ -62,6 +61,7 @@ protected: M.reset(); } + LLVMContext Ctx; std::unique_ptr<Module> M; Function *F; GlobalVariable *GV; @@ -72,7 +72,6 @@ protected: }; TEST_F(LinkModuleTest, BlockAddress) { - LLVMContext &Ctx = getGlobalContext(); IRBuilder<> Builder(EntryBB); std::vector<Value*> GEPIndices; @@ -93,7 +92,7 @@ TEST_F(LinkModuleTest, BlockAddress) { Builder.SetInsertPoint(ExitBB); Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx))); - Module *LinkedModule = new Module("MyModuleLinked", getGlobalContext()); + Module *LinkedModule = new Module("MyModuleLinked", Ctx); Linker::LinkModules(LinkedModule, M.get(), Linker::PreserveSource, 0); // Delete the original module. @@ -129,7 +128,6 @@ TEST_F(LinkModuleTest, BlockAddress) { } TEST_F(LinkModuleTest, EmptyModule) { - LLVMContext &Ctx = getGlobalContext(); Module *InternalM = new Module("InternalModule", Ctx); FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), |