diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-28 00:24:16 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-28 00:24:16 +0000 |
commit | c35c39b73c0afb658aebdde6edcbc98b924c8ef1 (patch) | |
tree | 4c21c45ed71cd74f739d6a381f06e5dc50906ddc /unittests/Linker | |
parent | 9ef2fd877567c1e060ca8327d7d8ce8d32a999bd (diff) |
Remove the PreserveSource linker mode.
I noticed that it was untested, and forcing it on caused some tests to fail:
LLVM :: Linker/metadata-a.ll
LLVM :: Linker/prefixdata.ll
LLVM :: Linker/type-unique-odr-a.ll
LLVM :: Linker/type-unique-simple-a.ll
LLVM :: Linker/type-unique-simple2-a.ll
LLVM :: Linker/type-unique-simple2.ll
LLVM :: Linker/type-unique-type-array-a.ll
LLVM :: Linker/unnamed-addr1-a.ll
LLVM :: Linker/visibility1.ll
If it is to be resurrected, it has to be fixed and we should probably have a
-preserve-source command line option in llvm-mc and run tests with and without
it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220741 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Linker')
-rw-r--r-- | unittests/Linker/LinkModulesTest.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/unittests/Linker/LinkModulesTest.cpp b/unittests/Linker/LinkModulesTest.cpp index 540849ec6a86..a21ee472f347 100644 --- a/unittests/Linker/LinkModulesTest.cpp +++ b/unittests/Linker/LinkModulesTest.cpp @@ -88,7 +88,7 @@ TEST_F(LinkModuleTest, BlockAddress) { Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx))); Module *LinkedModule = new Module("MyModuleLinked", Ctx); - Linker::LinkModules(LinkedModule, M.get(), Linker::PreserveSource); + Linker::LinkModules(LinkedModule, M.get()); // Delete the original module. M.reset(); @@ -122,12 +122,13 @@ TEST_F(LinkModuleTest, BlockAddress) { delete LinkedModule; } -TEST_F(LinkModuleTest, EmptyModule) { +static Module *getInternal(LLVMContext &Ctx) { Module *InternalM = new Module("InternalModule", Ctx); FunctionType *FTy = FunctionType::get( Type::getVoidTy(Ctx), Type::getInt8PtrTy(Ctx), false /*=isVarArgs*/); - F = Function::Create(FTy, Function::InternalLinkage, "bar", InternalM); + Function *F = + Function::Create(FTy, Function::InternalLinkage, "bar", InternalM); F->setCallingConv(CallingConv::C); BasicBlock *BB = BasicBlock::Create(Ctx, "", F); @@ -141,16 +142,19 @@ TEST_F(LinkModuleTest, EmptyModule) { GlobalValue::InternalLinkage, nullptr, "g"); GV->setInitializer(ConstantStruct::get(STy, F)); + return InternalM; +} - Module *EmptyM = new Module("EmptyModule1", Ctx); - Linker::LinkModules(EmptyM, InternalM, Linker::PreserveSource); - - delete EmptyM; - EmptyM = new Module("EmptyModule2", Ctx); - Linker::LinkModules(InternalM, EmptyM, Linker::PreserveSource); +TEST_F(LinkModuleTest, EmptyModule) { + std::unique_ptr<Module> InternalM(getInternal(Ctx)); + std::unique_ptr<Module> EmptyM(new Module("EmptyModule1", Ctx)); + Linker::LinkModules(EmptyM.get(), InternalM.get()); +} - delete EmptyM; - delete InternalM; +TEST_F(LinkModuleTest, EmptyModule2) { + std::unique_ptr<Module> InternalM(getInternal(Ctx)); + std::unique_ptr<Module> EmptyM(new Module("EmptyModule1", Ctx)); + Linker::LinkModules(InternalM.get(), EmptyM.get()); } } // end anonymous namespace |