[llvm] r207535 - LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). The global context might not be free'd. [vg_leak]
NAKAMURA Takumi
geek4civic at gmail.com
Tue Apr 29 08:52:27 PDT 2014
Author: chapuni
Date: Tue Apr 29 10:52:27 2014
New Revision: 207535
URL: http://llvm.org/viewvc/llvm-project?rev=207535&view=rev
Log:
LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). The global context might not be free'd. [vg_leak]
Modified:
llvm/trunk/unittests/Linker/LinkModulesTest.cpp
Modified: llvm/trunk/unittests/Linker/LinkModulesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Linker/LinkModulesTest.cpp?rev=207535&r1=207534&r2=207535&view=diff
==============================================================================
--- llvm/trunk/unittests/Linker/LinkModulesTest.cpp (original)
+++ llvm/trunk/unittests/Linker/LinkModulesTest.cpp Tue Apr 29 10:52:27 2014
@@ -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),
More information about the llvm-commits
mailing list