summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-02-21 21:55:49 +0000
committerLang Hames <lhames@gmail.com>2018-02-21 21:55:49 +0000
commit589eece1323e5ba20e8887bc4314db9af477ba77 (patch)
tree88ef672592bfa38e0beea4ee2761a9b27e196991 /llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
parentc1b46381dbfc070ccdba327d36053c154cde2b4f (diff)
downloadbcm5719-llvm-589eece1323e5ba20e8887bc4314db9af477ba77.tar.gz
bcm5719-llvm-589eece1323e5ba20e8887bc4314db9af477ba77.zip
[ORC] Switch RTDyldObjectLinkingLayer to take a unique_ptr<MemoryBuffer> rather
than a shared ObjectFile/MemoryBuffer pair. There's no need to pre-parse the buffer into an ObjectFile before passing it down to the linking layer, and moving the parsing into the linking layer allows us remove the parsing code at each call site. llvm-svn: 325725
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
index d24aafed9b0..ae408a06f84 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
@@ -24,8 +24,7 @@ public:
using ObjHandleT = uint64_t;
- using ObjectPtr =
- std::shared_ptr<object::OwningBinary<object::ObjectFile>>;
+ using ObjectPtr = std::unique_ptr<MemoryBuffer>;
using LookupFn = std::function<JITSymbol(StringRef, bool)>;
using SymbolLookupTable = std::map<ObjHandleT, LookupFn>;
@@ -43,7 +42,7 @@ public:
Expected<ObjHandleT> addObject(ObjectPtr Obj,
std::shared_ptr<JITSymbolResolver> Resolver) {
- return AddObject(Obj, SymTab);
+ return AddObject(std::move(Obj), SymTab);
}
Error removeObject(ObjHandleT H) {
@@ -102,8 +101,7 @@ MockObjectLayer::ObjectPtr createTestObject() {
B.CreateRet(ConstantInt::getSigned(Type::getInt32Ty(Ctx), 42));
SimpleCompiler IRCompiler(*TM);
- return std::make_shared<object::OwningBinary<object::ObjectFile>>(
- IRCompiler(*MB.getModule()));
+ return IRCompiler(*MB.getModule());
}
TEST(RemoteObjectLayer, AddObject) {
@@ -121,7 +119,7 @@ TEST(RemoteObjectLayer, AddObject) {
// Copy the bytes out of the test object: the copy will be used to verify
// that the original is correctly transmitted over RPC to the mock layer.
- StringRef ObjBytes = TestObject->getBinary()->getData();
+ StringRef ObjBytes = TestObject->getBuffer();
std::vector<char> ObjContents(ObjBytes.size());
std::copy(ObjBytes.begin(), ObjBytes.end(), ObjContents.begin());
@@ -134,7 +132,7 @@ TEST(RemoteObjectLayer, AddObject) {
MockObjectLayer::SymbolLookupTable &SymTab) {
// Check that the received object file content matches the original.
- StringRef RPCObjContents = Obj->getBinary()->getData();
+ StringRef RPCObjContents = Obj->getBuffer();
EXPECT_EQ(RPCObjContents.size(), ObjContents.size())
<< "RPC'd object file has incorrect size";
EXPECT_TRUE(std::equal(RPCObjContents.begin(), RPCObjContents.end(),
OpenPOWER on IntegriCloud