LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). The global...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 29 Apr 2014 15:52:27 +0000 (15:52 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 29 Apr 2014 15:52:27 +0000 (15:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207535 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Linker/LinkModulesTest.cpp

index 7b40b9f67215387b432cb419ffa67decf7cc4e02..ab383b464cabb7d64edeccc5cce6a09508c46363 100644 (file)
@@ -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),