summaryrefslogtreecommitdiff
path: root/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
commit08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch)
tree80108f0f128657f8623f8f66ad9735b4d88e7b47 /unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
parent7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff)
Notes
Diffstat (limited to 'unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp')
-rw-r--r--unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index 8878451bdec2e..7c821bc2c34b3 100644
--- a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -63,7 +63,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
bool &DebugSeen;
};
- RTDyldObjectLinkingLayer<> ObjLayer;
+ RTDyldObjectLinkingLayer ObjLayer;
LLVMContext Context;
auto M = llvm::make_unique<Module>("", Context);
@@ -85,9 +85,9 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
if (!TM)
return;
- auto OwningObj = SimpleCompiler(*TM)(*M);
- std::vector<object::ObjectFile*> Objs;
- Objs.push_back(OwningObj.getBinary());
+ auto Obj =
+ std::make_shared<object::OwningBinary<object::ObjectFile>>(
+ SimpleCompiler(*TM)(*M));
bool DebugSectionSeen = false;
auto SMMW =
@@ -103,21 +103,21 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
{
// Test with ProcessAllSections = false (the default).
- auto H = ObjLayer.addObjectSet(Objs, SMMW, &*Resolver);
+ auto H = ObjLayer.addObject(Obj, SMMW, &*Resolver);
ObjLayer.emitAndFinalize(H);
EXPECT_EQ(DebugSectionSeen, false)
<< "Unexpected debug info section";
- ObjLayer.removeObjectSet(H);
+ ObjLayer.removeObject(H);
}
{
// Test with ProcessAllSections = true.
ObjLayer.setProcessAllSections(true);
- auto H = ObjLayer.addObjectSet(Objs, SMMW, &*Resolver);
+ auto H = ObjLayer.addObject(Obj, SMMW, &*Resolver);
ObjLayer.emitAndFinalize(H);
EXPECT_EQ(DebugSectionSeen, true)
<< "Expected debug info section not seen";
- ObjLayer.removeObjectSet(H);
+ ObjLayer.removeObject(H);
}
}
@@ -125,7 +125,7 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
if (!TM)
return;
- RTDyldObjectLinkingLayer<> ObjLayer;
+ RTDyldObjectLinkingLayer ObjLayer;
SimpleCompiler Compile(*TM);
// Create a pair of modules that will trigger recursive finalization:
@@ -151,9 +151,9 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
Builder.CreateRet(FourtyTwo);
}
- auto Obj1 = Compile(*MB1.getModule());
- std::vector<object::ObjectFile*> Obj1Set;
- Obj1Set.push_back(Obj1.getBinary());
+ auto Obj1 =
+ std::make_shared<object::OwningBinary<object::ObjectFile>>(
+ Compile(*MB1.getModule()));
ModuleBuilder MB2(Context, "", "dummy");
{
@@ -164,9 +164,9 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
IRBuilder<> Builder(FooEntry);
Builder.CreateRet(Builder.CreateCall(BarDecl));
}
- auto Obj2 = Compile(*MB2.getModule());
- std::vector<object::ObjectFile*> Obj2Set;
- Obj2Set.push_back(Obj2.getBinary());
+ auto Obj2 =
+ std::make_shared<object::OwningBinary<object::ObjectFile>>(
+ Compile(*MB2.getModule()));
auto Resolver =
createLambdaResolver(
@@ -180,10 +180,10 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
});
auto SMMW = std::make_shared<SectionMemoryManagerWrapper>();
- ObjLayer.addObjectSet(std::move(Obj1Set), SMMW, &*Resolver);
- auto H = ObjLayer.addObjectSet(std::move(Obj2Set), SMMW, &*Resolver);
+ ObjLayer.addObject(std::move(Obj1), SMMW, &*Resolver);
+ auto H = ObjLayer.addObject(std::move(Obj2), SMMW, &*Resolver);
ObjLayer.emitAndFinalize(H);
- ObjLayer.removeObjectSet(H);
+ ObjLayer.removeObject(H);
// Finalization of module 2 should trigger finalization of module 1.
// Verify that finalize on SMMW is only called once.
@@ -195,7 +195,7 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
if (!TM)
return;
- RTDyldObjectLinkingLayer<> ObjLayer;
+ RTDyldObjectLinkingLayer ObjLayer;
SimpleCompiler Compile(*TM);
// Create a pair of unrelated modules:
@@ -222,9 +222,9 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
Builder.CreateRet(FourtyTwo);
}
- auto Obj1 = Compile(*MB1.getModule());
- std::vector<object::ObjectFile*> Obj1Set;
- Obj1Set.push_back(Obj1.getBinary());
+ auto Obj1 =
+ std::make_shared<object::OwningBinary<object::ObjectFile>>(
+ Compile(*MB1.getModule()));
ModuleBuilder MB2(Context, "", "dummy");
{
@@ -236,16 +236,16 @@ TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
Value *Seven = ConstantInt::getSigned(Int32Ty, 7);
Builder.CreateRet(Seven);
}
- auto Obj2 = Compile(*MB2.getModule());
- std::vector<object::ObjectFile*> Obj2Set;
- Obj2Set.push_back(Obj2.getBinary());
+ auto Obj2 =
+ std::make_shared<object::OwningBinary<object::ObjectFile>>(
+ Compile(*MB2.getModule()));
auto SMMW = std::make_shared<SectionMemoryManagerWrapper>();
NullResolver NR;
- auto H = ObjLayer.addObjectSet(std::move(Obj1Set), SMMW, &NR);
- ObjLayer.addObjectSet(std::move(Obj2Set), SMMW, &NR);
+ auto H = ObjLayer.addObject(std::move(Obj1), SMMW, &NR);
+ ObjLayer.addObject(std::move(Obj2), SMMW, &NR);
ObjLayer.emitAndFinalize(H);
- ObjLayer.removeObjectSet(H);
+ ObjLayer.removeObject(H);
// Only one call to needsToReserveAllocationSpace should have been made.
EXPECT_EQ(SMMW->NeedsToReserveAllocationSpaceCount, 1)