summaryrefslogtreecommitdiffstats
path: root/unittests/Linker
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-01 19:50:54 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-01 19:50:54 +0000
commit76c60c37de0a6250ce3be524e121d95ba7035c2e (patch)
tree41dc39a2ad5bd4f082c2b3f82a015fcdcce42d37 /unittests/Linker
parentb0b27c572556a67b2a9f5246b8ceeeb0895c6eec (diff)
Use references now that it is natural to do so.
The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Linker')
-rw-r--r--unittests/Linker/LinkModulesTest.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/unittests/Linker/LinkModulesTest.cpp b/unittests/Linker/LinkModulesTest.cpp
index a1d889a6b3dd..4eba718e2663 100644
--- a/unittests/Linker/LinkModulesTest.cpp
+++ b/unittests/Linker/LinkModulesTest.cpp
@@ -93,7 +93,7 @@ TEST_F(LinkModuleTest, BlockAddress) {
Builder.CreateRet(ConstantPointerNull::get(Type::getInt8PtrTy(Ctx)));
Module *LinkedModule = new Module("MyModuleLinked", Ctx);
- Linker::LinkModules(LinkedModule, M.get());
+ Linker::linkModules(*LinkedModule, *M);
// Delete the original module.
M.reset();
@@ -169,13 +169,13 @@ static Module *getInternal(LLVMContext &Ctx) {
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());
+ Linker::linkModules(*EmptyM, *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());
+ Linker::linkModules(*InternalM, *EmptyM);
}
TEST_F(LinkModuleTest, TypeMerge) {
@@ -190,7 +190,7 @@ TEST_F(LinkModuleTest, TypeMerge) {
"@t2 = weak global %t zeroinitializer\n";
std::unique_ptr<Module> M2 = parseAssemblyString(M2Str, Err, C);
- Linker::LinkModules(M1.get(), M2.get(), [](const llvm::DiagnosticInfo &){});
+ Linker::linkModules(*M1, *M2, [](const llvm::DiagnosticInfo &) {});
EXPECT_EQ(M1->getNamedGlobal("t1")->getType(),
M1->getNamedGlobal("t2")->getType());
@@ -267,8 +267,7 @@ TEST_F(LinkModuleTest, MoveDistinctMDs) {
// Link into destination module.
auto Dst = llvm::make_unique<Module>("Linked", C);
ASSERT_TRUE(Dst.get());
- Linker::LinkModules(Dst.get(), Src.get(),
- [](const llvm::DiagnosticInfo &) {});
+ Linker::linkModules(*Dst, *Src, [](const llvm::DiagnosticInfo &) {});
// Check that distinct metadata was moved, not cloned. Even !4, the uniqued
// node, should effectively be moved, since its only operand hasn't changed.