[llvm] r217065 - unique_ptrify a bunch of stuff through RuntimeDyld::loadObject
David Blaikie
dblaikie at gmail.com
Thu Sep 4 11:47:49 PDT 2014
On Thu, Sep 4, 2014 at 11:44 AM, Alexey Samsonov <vonosmas at gmail.com> wrote:
>
>
> On Wed, Sep 3, 2014 at 12:48 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Author: dblaikie
>> Date: Wed Sep 3 14:48:09 2014
>> New Revision: 217065
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=217065&view=rev
>> Log:
>> unique_ptrify a bunch of stuff through RuntimeDyld::loadObject
>>
>> Modified:
>> llvm/trunk/include/llvm/ExecutionEngine/ObjectBuffer.h
>> llvm/trunk/include/llvm/ExecutionEngine/ObjectImage.h
>> llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
>> llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
>> llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
>> llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/ObjectBuffer.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ObjectBuffer.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ExecutionEngine/ObjectBuffer.h (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/ObjectBuffer.h Wed Sep 3
>> 14:48:09 2014
>> @@ -29,7 +29,7 @@ class ObjectBuffer {
>> virtual void anchor();
>> public:
>> ObjectBuffer() {}
>> - ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
>> + ObjectBuffer(std::unique_ptr<MemoryBuffer> Buf) :
>> Buffer(std::move(Buf)) {}
>> virtual ~ObjectBuffer() {}
>>
>> MemoryBufferRef getMemBuffer() const { return
>> Buffer->getMemBufferRef(); }
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/ObjectImage.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ObjectImage.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ExecutionEngine/ObjectImage.h (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/ObjectImage.h Wed Sep 3
>> 14:48:09 2014
>> @@ -31,7 +31,7 @@ protected:
>> std::unique_ptr<ObjectBuffer> Buffer;
>>
>> public:
>> - ObjectImage(ObjectBuffer *Input) : Buffer(Input) {}
>> + ObjectImage(std::unique_ptr<ObjectBuffer> Input) :
>> Buffer(std::move(Input)) {}
>> virtual ~ObjectImage() {}
>>
>> virtual object::symbol_iterator begin_symbols() const = 0;
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h Wed Sep 3
>> 14:48:09 2014
>> @@ -53,13 +53,15 @@ public:
>> /// Ownership of the input buffer is transferred to the ObjectImage
>> /// instance returned from this function if successful. In the case of
>> load
>> /// failure, the input buffer will be deleted.
>> - ObjectImage *loadObject(ObjectBuffer *InputBuffer);
>> + std::unique_ptr<ObjectImage>
>> + loadObject(std::unique_ptr<ObjectBuffer> InputBuffer);
>>
>> /// Prepare the referenced object file for execution.
>> /// Ownership of the input object is transferred to the ObjectImage
>> /// instance returned from this function if successful. In the case of
>> load
>> /// failure, the input object will be deleted.
>> - ObjectImage *loadObject(std::unique_ptr<object::ObjectFile>
>> InputObject);
>> + std::unique_ptr<ObjectImage>
>> + loadObject(std::unique_ptr<object::ObjectFile> InputObject);
>>
>> /// Get the address of our local copy of the symbol. This may or may
>> not
>> /// be the address used for relocation (clients can copy the data
>> around
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed Sep 3 14:48:09
>> 2014
>> @@ -82,15 +82,9 @@ MCJIT::~MCJIT() {
>>
>> Dyld.deregisterEHFrames();
>>
>> - LoadedObjectList::iterator it, end;
>> - for (it = LoadedObjects.begin(), end = LoadedObjects.end(); it != end;
>> ++it) {
>> - ObjectImage *Obj = *it;
>> - if (Obj) {
>> + for (auto &Obj : LoadedObjects)
>> + if (Obj)
>> NotifyFreeingObject(*Obj);
>> - delete Obj;
>> - }
>> - }
>> - LoadedObjects.clear();
>>
>> Archives.clear();
>> }
>> @@ -106,11 +100,11 @@ bool MCJIT::removeModule(Module *M) {
>> }
>>
>> void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
>> - ObjectImage *LoadedObject = Dyld.loadObject(std::move(Obj));
>> + std::unique_ptr<ObjectImage> LoadedObject =
>> Dyld.loadObject(std::move(Obj));
>> if (!LoadedObject || Dyld.hasError())
>> report_fatal_error(Dyld.getErrorString());
>>
>> - LoadedObjects.push_back(LoadedObject);
>> + LoadedObjects.push_back(std::move(LoadedObject));
>>
>
>> NotifyObjectEmitted(*LoadedObject);
>>
>
> Hm? You can't really dereference LoadedObject after you std::move'd it,
> can you?
>
Indeed - thanks for the catch. Fixed in r217065.
>
>
>
>> }
>> @@ -183,9 +177,10 @@ void MCJIT::generateCodeForModule(Module
>> std::unique_ptr<ObjectBuffer> ObjectToLoad;
>> // Try to load the pre-compiled object from cache if possible
>> if (ObjCache) {
>> - std::unique_ptr<MemoryBuffer>
>> PreCompiledObject(ObjCache->getObject(M));
>> - if (PreCompiledObject.get())
>> - ObjectToLoad.reset(new ObjectBuffer(PreCompiledObject.release()));
>> + if (std::unique_ptr<MemoryBuffer> PreCompiledObject =
>> + ObjCache->getObject(M))
>> + ObjectToLoad =
>> + llvm::make_unique<ObjectBuffer>(std::move(PreCompiledObject));
>> }
>>
>> // If the cache did not contain a suitable object, compile the object
>> @@ -196,8 +191,8 @@ void MCJIT::generateCodeForModule(Module
>>
>> // Load the object into the dynamic linker.
>> // MCJIT now owns the ObjectImage pointer (via its LoadedObjects list).
>> - ObjectImage *LoadedObject = Dyld.loadObject(ObjectToLoad.release());
>> - LoadedObjects.push_back(LoadedObject);
>> + std::unique_ptr<ObjectImage> LoadedObject =
>> + Dyld.loadObject(std::move(ObjectToLoad));
>> if (!LoadedObject)
>> report_fatal_error(Dyld.getErrorString());
>>
>> @@ -206,6 +201,8 @@ void MCJIT::generateCodeForModule(Module
>>
>> NotifyObjectEmitted(*LoadedObject);
>>
>> + LoadedObjects.push_back(std::move(LoadedObject));
>> +
>> OwnedModules.markModuleAsLoaded(M);
>> }
>>
>> @@ -563,10 +560,8 @@ void MCJIT::NotifyObjectEmitted(const Ob
>> }
>> void MCJIT::NotifyFreeingObject(const ObjectImage& Obj) {
>> MutexGuard locked(lock);
>> - for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
>> - JITEventListener *L = EventListeners[I];
>> + for (JITEventListener *L : EventListeners)
>> L->NotifyFreeingObject(Obj);
>> - }
>> }
>>
>> uint64_t LinkingMemoryManager::getSymbolAddress(const std::string &Name)
>> {
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
>> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Wed Sep 3 14:48:09 2014
>> @@ -219,8 +219,7 @@ class MCJIT : public ExecutionEngine {
>> SmallVector<object::OwningBinary<object::Archive>, 2> Archives;
>> SmallVector<std::unique_ptr<MemoryBuffer>, 2> Buffers;
>>
>> - typedef SmallVector<ObjectImage *, 2> LoadedObjectList;
>> - LoadedObjectList LoadedObjects;
>> + SmallVector<std::unique_ptr<ObjectImage>, 2> LoadedObjects;
>>
>> // An optional ObjectCache to be notified of compiled objects and used
>> to
>> // perform lookup of pre-compiled code to avoid re-compilation.
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
>> (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h Wed
>> Sep 3 14:48:09 2014
>> @@ -36,16 +36,13 @@ protected:
>>
>> // This form of the constructor allows subclasses to use
>> // format-specific subclasses of ObjectFile directly
>> - ObjectImageCommon(ObjectBuffer *Input,
>> std::unique_ptr<object::ObjectFile> Obj)
>> - : ObjectImage(Input), // saves Input as Buffer and takes ownership
>> - ObjFile(std::move(Obj))
>> - {
>> - }
>> + ObjectImageCommon(std::unique_ptr<ObjectBuffer> Input,
>> + std::unique_ptr<object::ObjectFile> Obj)
>> + : ObjectImage(std::move(Input)), ObjFile(std::move(Obj)) {}
>>
>> public:
>> - ObjectImageCommon(ObjectBuffer* Input)
>> - : ObjectImage(Input) // saves Input as Buffer and takes ownership
>> - {
>> + ObjectImageCommon(std::unique_ptr<ObjectBuffer> Input)
>> + : ObjectImage(std::move(Input)) {
>> // FIXME: error checking? createObjectFile returns an
>> ErrorOr<ObjectFile*>
>> // and should probably be checked for failure.
>> MemoryBufferRef Buf = Buffer->getMemBuffer();
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Wed Sep 3
>> 14:48:09 2014
>> @@ -794,7 +794,8 @@ createRuntimeDyldMachO(Triple::ArchType
>> return Dyld;
>> }
>>
>> -ObjectImage *RuntimeDyld::loadObject(std::unique_ptr<ObjectFile>
>> InputObject) {
>> +std::unique_ptr<ObjectImage>
>> +RuntimeDyld::loadObject(std::unique_ptr<ObjectFile> InputObject) {
>> std::unique_ptr<ObjectImage> InputImage;
>>
>> ObjectFile &Obj = *InputObject;
>> @@ -816,19 +817,21 @@ ObjectImage *RuntimeDyld::loadObject(std
>> report_fatal_error("Incompatible object format!");
>>
>> Dyld->loadObject(InputImage.get());
>> - return InputImage.release();
>> + return InputImage;
>> }
>>
>> -ObjectImage *RuntimeDyld::loadObject(ObjectBuffer *InputBuffer) {
>> +std::unique_ptr<ObjectImage>
>> +RuntimeDyld::loadObject(std::unique_ptr<ObjectBuffer> InputBuffer) {
>> std::unique_ptr<ObjectImage> InputImage;
>> sys::fs::file_magic Type =
>> sys::fs::identify_magic(InputBuffer->getBuffer());
>> + auto *InputBufferPtr = InputBuffer.get();
>>
>> switch (Type) {
>> case sys::fs::file_magic::elf_relocatable:
>> case sys::fs::file_magic::elf_executable:
>> case sys::fs::file_magic::elf_shared_object:
>> case sys::fs::file_magic::elf_core:
>> - InputImage.reset(RuntimeDyldELF::createObjectImage(InputBuffer));
>> + InputImage =
>> RuntimeDyldELF::createObjectImage(std::move(InputBuffer));
>> if (!Dyld)
>> Dyld = createRuntimeDyldELF(MM, ProcessAllSections,
>> Checker).release();
>> break;
>> @@ -842,7 +845,7 @@ ObjectImage *RuntimeDyld::loadObject(Obj
>> case sys::fs::file_magic::macho_bundle:
>> case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
>> case sys::fs::file_magic::macho_dsym_companion:
>> - InputImage.reset(RuntimeDyldMachO::createObjectImage(InputBuffer));
>> + InputImage =
>> RuntimeDyldMachO::createObjectImage(std::move(InputBuffer));
>> if (!Dyld)
>> Dyld = createRuntimeDyldMachO(
>>
>> static_cast<Triple::ArchType>(InputImage->getArch()),
>> @@ -859,11 +862,11 @@ ObjectImage *RuntimeDyld::loadObject(Obj
>> report_fatal_error("Incompatible object format!");
>> }
>>
>> - if (!Dyld->isCompatibleFormat(InputBuffer))
>> + if (!Dyld->isCompatibleFormat(InputBufferPtr))
>> report_fatal_error("Incompatible object format!");
>>
>> Dyld->loadObject(InputImage.get());
>> - return InputImage.release();
>> + return InputImage;
>> }
>>
>> void *RuntimeDyld::getSymbolAddress(StringRef Name) {
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>> (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Wed
>> Sep 3 14:48:09 2014
>> @@ -77,8 +77,10 @@ template <class ELFT> class ELFObjectIma
>> bool Registered;
>>
>> public:
>> - ELFObjectImage(ObjectBuffer *Input,
>> std::unique_ptr<DyldELFObject<ELFT>> Obj)
>> - : ObjectImageCommon(Input, std::move(Obj)), Registered(false) {}
>> + ELFObjectImage(std::unique_ptr<ObjectBuffer> Input,
>> + std::unique_ptr<DyldELFObject<ELFT>> Obj)
>> + : ObjectImageCommon(std::move(Input), std::move(Obj)),
>> Registered(false) {
>> + }
>>
>> virtual ~ELFObjectImage() {
>> if (Registered)
>> @@ -212,7 +214,8 @@ RuntimeDyldELF::createObjectImageFromFil
>> llvm_unreachable("Unexpected ELF format");
>> }
>>
>> -ObjectImage *RuntimeDyldELF::createObjectImage(ObjectBuffer *Buffer) {
>> +std::unique_ptr<ObjectImage>
>> +RuntimeDyldELF::createObjectImage(std::unique_ptr<ObjectBuffer> Buffer) {
>> if (Buffer->getBufferSize() < ELF::EI_NIDENT)
>> llvm_unreachable("Unexpected ELF object size");
>> std::pair<unsigned char, unsigned char> Ident =
>> @@ -226,28 +229,30 @@ ObjectImage *RuntimeDyldELF::createObjec
>> auto Obj =
>> llvm::make_unique<DyldELFObject<ELFType<support::little, 4,
>> false>>>(
>> Buf, ec);
>> - return new ELFObjectImage<ELFType<support::little, 4, false>>(
>> - Buffer, std::move(Obj));
>> - } else if (Ident.first == ELF::ELFCLASS32 &&
>> - Ident.second == ELF::ELFDATA2MSB) {
>> + return llvm::make_unique<
>> + ELFObjectImage<ELFType<support::little, 4,
>> false>>>(std::move(Buffer),
>> +
>> std::move(Obj));
>> + }
>> + if (Ident.first == ELF::ELFCLASS32 && Ident.second ==
>> ELF::ELFDATA2MSB) {
>> auto Obj =
>> llvm::make_unique<DyldELFObject<ELFType<support::big, 4,
>> false>>>(Buf,
>>
>> ec);
>> - return new ELFObjectImage<ELFType<support::big, 4, false>>(Buffer,
>> -
>> std::move(Obj));
>> - } else if (Ident.first == ELF::ELFCLASS64 &&
>> - Ident.second == ELF::ELFDATA2MSB) {
>> + return llvm::make_unique<ELFObjectImage<ELFType<support::big, 4,
>> false>>>(
>> + std::move(Buffer), std::move(Obj));
>> + }
>> + if (Ident.first == ELF::ELFCLASS64 && Ident.second ==
>> ELF::ELFDATA2MSB) {
>> auto Obj = llvm::make_unique<DyldELFObject<ELFType<support::big, 8,
>> true>>>(
>> Buf, ec);
>> - return new ELFObjectImage<ELFType<support::big, 8, true>>(Buffer,
>> std::move(Obj));
>> - } else if (Ident.first == ELF::ELFCLASS64 &&
>> - Ident.second == ELF::ELFDATA2LSB) {
>> - auto Obj =
>> - llvm::make_unique<DyldELFObject<ELFType<support::little, 8,
>> true>>>(Buf,
>> -
>> ec);
>> - return new ELFObjectImage<ELFType<support::little, 8, true>>(Buffer,
>> std::move(Obj));
>> - } else
>> - llvm_unreachable("Unexpected ELF format");
>> + return llvm::make_unique<ELFObjectImage<ELFType<support::big, 8,
>> true>>>(
>> + std::move(Buffer), std::move(Obj));
>> + }
>> + assert(Ident.first == ELF::ELFCLASS64 && Ident.second ==
>> ELF::ELFDATA2LSB &&
>> + "Unexpected ELF format");
>> + auto Obj =
>> + llvm::make_unique<DyldELFObject<ELFType<support::little, 8,
>> true>>>(Buf,
>> +
>> ec);
>> + return llvm::make_unique<ELFObjectImage<ELFType<support::little, 8,
>> true>>>(
>> + std::move(Buffer), std::move(Obj));
>> }
>>
>> RuntimeDyldELF::~RuntimeDyldELF() {}
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h Wed Sep
>> 3 14:48:09 2014
>> @@ -119,7 +119,8 @@ public:
>> ObjSectionToIDMap &SectionMap) override;
>> virtual ~RuntimeDyldELF();
>>
>> - static ObjectImage *createObjectImage(ObjectBuffer *InputBuffer);
>> + static std::unique_ptr<ObjectImage>
>> + createObjectImage(std::unique_ptr<ObjectBuffer> InputBuffer);
>> static ObjectImage
>> *createObjectImageFromFile(std::unique_ptr<object::ObjectFile> Obj);
>> };
>>
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
>> (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h Wed
>> Sep 3 14:48:09 2014
>> @@ -103,8 +103,9 @@ protected:
>>
>> public:
>> /// Create an ObjectImage from the given ObjectBuffer.
>> - static ObjectImage *createObjectImage(ObjectBuffer *InputBuffer) {
>> - return new ObjectImageCommon(InputBuffer);
>> + static std::unique_ptr<ObjectImage>
>> + createObjectImage(std::unique_ptr<ObjectBuffer> InputBuffer) {
>> + return llvm::make_unique<ObjectImageCommon>(std::move(InputBuffer));
>> }
>>
>> /// Create an ObjectImage from the given ObjectFile.
>>
>> Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=217065&r1=217064&r2=217065&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
>> +++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Wed Sep 3 14:48:09 2014
>> @@ -203,8 +203,8 @@ static int printLineInfoForInput() {
>>
>> std::unique_ptr<ObjectImage> LoadedObject;
>> // Load the object file
>> - LoadedObject.reset(
>> - Dyld.loadObject(new ObjectBuffer(InputBuffer.get().release())));
>> + LoadedObject = Dyld.loadObject(
>> + llvm::make_unique<ObjectBuffer>(std::move(*InputBuffer)));
>> if (!LoadedObject) {
>> return Error(Dyld.getErrorString());
>> }
>> @@ -264,8 +264,8 @@ static int executeInput() {
>> return Error("unable to read input: '" + EC.message() + "'");
>> std::unique_ptr<ObjectImage> LoadedObject;
>> // Load the object file
>> - LoadedObject.reset(
>> - Dyld.loadObject(new ObjectBuffer(InputBuffer.get().release())));
>> + LoadedObject = Dyld.loadObject(
>> + llvm::make_unique<ObjectBuffer>(std::move(*InputBuffer)));
>> if (!LoadedObject) {
>> return Error(Dyld.getErrorString());
>> }
>> @@ -427,8 +427,8 @@ static int linkAndVerify() {
>>
>> std::unique_ptr<ObjectImage> LoadedObject;
>> // Load the object file
>> - LoadedObject.reset(
>> - Dyld.loadObject(new ObjectBuffer(InputBuffer.get().release())));
>> + LoadedObject = Dyld.loadObject(
>> + llvm::make_unique<ObjectBuffer>(std::move(*InputBuffer)));
>> if (!LoadedObject) {
>> return Error(Dyld.getErrorString());
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140904/a7cf68b7/attachment.html>
More information about the llvm-commits
mailing list