[llvm] r211546 - Pass a std::unique_ptr& to the create??? methods is lib/Object.
Rafael Espindola
rafael.espindola at gmail.com
Mon Jun 23 15:00:38 PDT 2014
Author: rafael
Date: Mon Jun 23 17:00:37 2014
New Revision: 211546
URL: http://llvm.org/viewvc/llvm-project?rev=211546&view=rev
Log:
Pass a std::unique_ptr& to the create??? methods is lib/Object.
This makes the buffer ownership on error conditions very natural. The buffer
is only moved out of the argument if an object is constructed that now
owns the buffer.
Modified:
llvm/trunk/include/llvm/Object/Binary.h
llvm/trunk/include/llvm/Object/ObjectFile.h
llvm/trunk/include/llvm/Object/SymbolicFile.h
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
llvm/trunk/lib/Object/Archive.cpp
llvm/trunk/lib/Object/Binary.cpp
llvm/trunk/lib/Object/ELFObjectFile.cpp
llvm/trunk/lib/Object/MachOObjectFile.cpp
llvm/trunk/lib/Object/MachOUniversal.cpp
llvm/trunk/lib/Object/Object.cpp
llvm/trunk/lib/Object/ObjectFile.cpp
llvm/trunk/lib/Object/SymbolicFile.cpp
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
llvm/trunk/tools/llvm-objdump/MachODump.cpp
Modified: llvm/trunk/include/llvm/Object/Binary.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Binary.h?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/Binary.h (original)
+++ llvm/trunk/include/llvm/Object/Binary.h Mon Jun 23 17:00:37 2014
@@ -128,7 +128,7 @@ public:
/// @param Source The data to create the Binary from. Ownership is transferred
/// to the Binary if successful. If an error is returned,
/// Source is destroyed by createBinary before returning.
-ErrorOr<Binary *> createBinary(MemoryBuffer *Source,
+ErrorOr<Binary *> createBinary(std::unique_ptr<MemoryBuffer> &Source,
LLVMContext *Context = nullptr);
ErrorOr<Binary *> createBinary(StringRef Path);
Modified: llvm/trunk/include/llvm/Object/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ObjectFile.h?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ObjectFile.h Mon Jun 23 17:00:37 2014
@@ -333,9 +333,11 @@ public:
/// return true.
/// @brief Create ObjectFile from path.
static ErrorOr<ObjectFile *> createObjectFile(StringRef ObjectPath);
- static ErrorOr<ObjectFile *> createObjectFile(MemoryBuffer *Object,
- sys::fs::file_magic Type);
- static ErrorOr<ObjectFile *> createObjectFile(MemoryBuffer *Object) {
+ static ErrorOr<ObjectFile *>
+ createObjectFile(std::unique_ptr<MemoryBuffer> &Object,
+ sys::fs::file_magic Type);
+ static ErrorOr<ObjectFile *>
+ createObjectFile(std::unique_ptr<MemoryBuffer> &Object) {
return createObjectFile(Object, sys::fs::file_magic::unknown);
}
@@ -346,8 +348,10 @@ public:
public:
static ErrorOr<ObjectFile *> createCOFFObjectFile(MemoryBuffer *Object);
- static ErrorOr<ObjectFile *> createELFObjectFile(MemoryBuffer *Object);
- static ErrorOr<ObjectFile *> createMachOObjectFile(MemoryBuffer *Object);
+ static ErrorOr<ObjectFile *>
+ createELFObjectFile(std::unique_ptr<MemoryBuffer> &Object);
+ static ErrorOr<ObjectFile *>
+ createMachOObjectFile(std::unique_ptr<MemoryBuffer> &Object);
};
// Inline function definitions.
Modified: llvm/trunk/include/llvm/Object/SymbolicFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/SymbolicFile.h?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/SymbolicFile.h (original)
+++ llvm/trunk/include/llvm/Object/SymbolicFile.h Mon Jun 23 17:00:37 2014
@@ -145,11 +145,12 @@ public:
static ErrorOr<SymbolicFile *> createIRObjectFile(MemoryBuffer *Object,
LLVMContext &Context);
- static ErrorOr<SymbolicFile *> createSymbolicFile(MemoryBuffer *Object,
- sys::fs::file_magic Type,
- LLVMContext *Context);
+ static ErrorOr<SymbolicFile *>
+ createSymbolicFile(std::unique_ptr<MemoryBuffer> &Object,
+ sys::fs::file_magic Type, LLVMContext *Context);
- static ErrorOr<SymbolicFile *> createSymbolicFile(MemoryBuffer *Object) {
+ static ErrorOr<SymbolicFile *>
+ createSymbolicFile(std::unique_ptr<MemoryBuffer> &Object) {
return createSymbolicFile(Object, sys::fs::file_magic::unknown, nullptr);
}
static ErrorOr<SymbolicFile *> createSymbolicFile(StringRef ObjectPath);
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h Mon Jun 23 17:00:37 2014
@@ -48,7 +48,8 @@ public:
{
// FIXME: error checking? createObjectFile returns an ErrorOr<ObjectFile*>
// and should probably be checked for failure.
- ObjFile.reset(object::ObjectFile::createObjectFile(Buffer->getMemBuffer()).get());
+ std::unique_ptr<MemoryBuffer> Buf(Buffer->getMemBuffer());
+ ObjFile.reset(object::ObjectFile::createObjectFile(Buf).get());
}
ObjectImageCommon(std::unique_ptr<object::ObjectFile> Input)
: ObjectImage(nullptr), ObjFile(std::move(Input)) {}
Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Mon Jun 23 17:00:37 2014
@@ -183,10 +183,7 @@ Archive::Child::getAsBinary(LLVMContext
return EC;
std::unique_ptr<MemoryBuffer> Buff(BuffOrErr.get().release());
- ErrorOr<std::unique_ptr<Binary>> Ret = createBinary(Buff.get(), Context);
- if (!Ret.getError())
- Buff.release();
- return Ret;
+ return createBinary(Buff, Context);
}
ErrorOr<Archive*> Archive::create(MemoryBuffer *Source) {
Modified: llvm/trunk/lib/Object/Binary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Binary.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Binary.cpp (original)
+++ llvm/trunk/lib/Object/Binary.cpp Mon Jun 23 17:00:37 2014
@@ -38,13 +38,13 @@ StringRef Binary::getFileName() const {
return Data->getBufferIdentifier();
}
-ErrorOr<Binary *> object::createBinary(MemoryBuffer *Buffer,
+ErrorOr<Binary *> object::createBinary(std::unique_ptr<MemoryBuffer> &Buffer,
LLVMContext *Context) {
sys::fs::file_magic Type = sys::fs::identify_magic(Buffer->getBuffer());
switch (Type) {
case sys::fs::file_magic::archive:
- return Archive::create(Buffer);
+ return Archive::create(Buffer.release());
case sys::fs::file_magic::elf_relocatable:
case sys::fs::file_magic::elf_executable:
case sys::fs::file_magic::elf_shared_object:
@@ -65,7 +65,7 @@ ErrorOr<Binary *> object::createBinary(M
case sys::fs::file_magic::bitcode:
return ObjectFile::createSymbolicFile(Buffer, Type, Context);
case sys::fs::file_magic::macho_universal_binary:
- return MachOUniversalBinary::create(Buffer);
+ return MachOUniversalBinary::create(Buffer.release());
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::windows_resource:
// Unrecognized object file format.
@@ -78,5 +78,5 @@ ErrorOr<Binary *> object::createBinary(S
std::unique_ptr<MemoryBuffer> File;
if (std::error_code EC = MemoryBuffer::getFileOrSTDIN(Path, File))
return EC;
- return createBinary(File.release());
+ return createBinary(File);
}
Modified: llvm/trunk/lib/Object/ELFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELFObjectFile.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ELFObjectFile.cpp Mon Jun 23 17:00:37 2014
@@ -17,8 +17,9 @@
namespace llvm {
using namespace object;
-ErrorOr<ObjectFile *> ObjectFile::createELFObjectFile(MemoryBuffer *Obj) {
- std::pair<unsigned char, unsigned char> Ident = getElfArchType(Obj);
+ErrorOr<ObjectFile *>
+ObjectFile::createELFObjectFile(std::unique_ptr<MemoryBuffer> &Obj) {
+ std::pair<unsigned char, unsigned char> Ident = getElfArchType(Obj.get());
std::size_t MaxAlignment =
1ULL << countTrailingZeros(uintptr_t(Obj->getBufferStart()));
@@ -27,41 +28,49 @@ ErrorOr<ObjectFile *> ObjectFile::create
if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 4)
- R.reset(new ELFObjectFile<ELFType<support::little, 4, false>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::little, 4, false>>(
+ Obj.release(), EC));
else
#endif
if (MaxAlignment >= 2)
- R.reset(new ELFObjectFile<ELFType<support::little, 2, false>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::little, 2, false>>(
+ Obj.release(), EC));
else
return object_error::parse_failed;
else if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 4)
- R.reset(new ELFObjectFile<ELFType<support::big, 4, false>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::big, 4, false>>(Obj.release(),
+ EC));
else
#endif
if (MaxAlignment >= 2)
- R.reset(new ELFObjectFile<ELFType<support::big, 2, false>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::big, 2, false>>(Obj.release(),
+ EC));
else
return object_error::parse_failed;
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 8)
- R.reset(new ELFObjectFile<ELFType<support::big, 8, true>>(Obj, EC));
+ R.reset(
+ new ELFObjectFile<ELFType<support::big, 8, true>>(Obj.release(), EC));
else
#endif
if (MaxAlignment >= 2)
- R.reset(new ELFObjectFile<ELFType<support::big, 2, true>>(Obj, EC));
+ R.reset(
+ new ELFObjectFile<ELFType<support::big, 2, true>>(Obj.release(), EC));
else
return object_error::parse_failed;
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2LSB) {
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 8)
- R.reset(new ELFObjectFile<ELFType<support::little, 8, true>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::little, 8, true>>(
+ Obj.release(), EC));
else
#endif
if (MaxAlignment >= 2)
- R.reset(new ELFObjectFile<ELFType<support::little, 2, true>>(Obj, EC));
+ R.reset(new ELFObjectFile<ELFType<support::little, 2, true>>(
+ Obj.release(), EC));
else
return object_error::parse_failed;
}
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Mon Jun 23 17:00:37 2014
@@ -1811,22 +1811,21 @@ void MachOObjectFile::ReadULEB128s(uint6
}
}
-ErrorOr<ObjectFile *> ObjectFile::createMachOObjectFile(MemoryBuffer *Buffer) {
+ErrorOr<ObjectFile *>
+ObjectFile::createMachOObjectFile(std::unique_ptr<MemoryBuffer> &Buffer) {
StringRef Magic = Buffer->getBuffer().slice(0, 4);
std::error_code EC;
std::unique_ptr<MachOObjectFile> Ret;
if (Magic == "\xFE\xED\xFA\xCE")
- Ret.reset(new MachOObjectFile(Buffer, false, false, EC));
+ Ret.reset(new MachOObjectFile(Buffer.release(), false, false, EC));
else if (Magic == "\xCE\xFA\xED\xFE")
- Ret.reset(new MachOObjectFile(Buffer, true, false, EC));
+ Ret.reset(new MachOObjectFile(Buffer.release(), true, false, EC));
else if (Magic == "\xFE\xED\xFA\xCF")
- Ret.reset(new MachOObjectFile(Buffer, false, true, EC));
+ Ret.reset(new MachOObjectFile(Buffer.release(), false, true, EC));
else if (Magic == "\xCF\xFA\xED\xFE")
- Ret.reset(new MachOObjectFile(Buffer, true, true, EC));
- else {
- delete Buffer;
+ Ret.reset(new MachOObjectFile(Buffer.release(), true, true, EC));
+ else
return object_error::parse_failed;
- }
if (EC)
return EC;
Modified: llvm/trunk/lib/Object/MachOUniversal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOUniversal.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOUniversal.cpp (original)
+++ llvm/trunk/lib/Object/MachOUniversal.cpp Mon Jun 23 17:00:37 2014
@@ -73,8 +73,8 @@ MachOUniversalBinary::ObjectForArch::get
StringRef ParentData = Parent->getData();
StringRef ObjectData = ParentData.substr(Header.offset, Header.size);
std::string ObjectName = Parent->getFileName().str();
- MemoryBuffer *ObjBuffer = MemoryBuffer::getMemBuffer(
- ObjectData, ObjectName, false);
+ std::unique_ptr<MemoryBuffer> ObjBuffer(
+ MemoryBuffer::getMemBuffer(ObjectData, ObjectName, false));
return ObjectFile::createMachOObjectFile(ObjBuffer);
}
return object_error::parse_failed;
Modified: llvm/trunk/lib/Object/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Object.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Object.cpp (original)
+++ llvm/trunk/lib/Object/Object.cpp Mon Jun 23 17:00:37 2014
@@ -59,7 +59,9 @@ wrap(const relocation_iterator *SI) {
// ObjectFile creation
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
- ErrorOr<ObjectFile*> ObjOrErr(ObjectFile::createObjectFile(unwrap(MemBuf)));
+ std::unique_ptr<MemoryBuffer> Buf(unwrap(MemBuf));
+ ErrorOr<ObjectFile *> ObjOrErr(ObjectFile::createObjectFile(Buf));
+ Buf.release();
ObjectFile *Obj = ObjOrErr ? ObjOrErr.get() : nullptr;
return wrap(Obj);
}
Modified: llvm/trunk/lib/Object/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ObjectFile.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ObjectFile.cpp Mon Jun 23 17:00:37 2014
@@ -45,8 +45,9 @@ section_iterator ObjectFile::getRelocate
return section_iterator(SectionRef(Sec, this));
}
-ErrorOr<ObjectFile *> ObjectFile::createObjectFile(MemoryBuffer *Object,
- sys::fs::file_magic Type) {
+ErrorOr<ObjectFile *>
+ObjectFile::createObjectFile(std::unique_ptr<MemoryBuffer> &Object,
+ sys::fs::file_magic Type) {
if (Type == sys::fs::file_magic::unknown)
Type = sys::fs::identify_magic(Object->getBuffer());
@@ -76,7 +77,7 @@ ErrorOr<ObjectFile *> ObjectFile::create
case sys::fs::file_magic::coff_object:
case sys::fs::file_magic::coff_import_library:
case sys::fs::file_magic::pecoff_executable:
- return createCOFFObjectFile(Object);
+ return createCOFFObjectFile(Object.release());
}
llvm_unreachable("Unexpected Object File Type");
}
@@ -85,5 +86,5 @@ ErrorOr<ObjectFile *> ObjectFile::create
std::unique_ptr<MemoryBuffer> File;
if (std::error_code EC = MemoryBuffer::getFile(ObjectPath, File))
return EC;
- return createObjectFile(File.release());
+ return createObjectFile(File);
}
Modified: llvm/trunk/lib/Object/SymbolicFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/SymbolicFile.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/lib/Object/SymbolicFile.cpp (original)
+++ llvm/trunk/lib/Object/SymbolicFile.cpp Mon Jun 23 17:00:37 2014
@@ -25,7 +25,8 @@ SymbolicFile::SymbolicFile(unsigned int
SymbolicFile::~SymbolicFile() {}
ErrorOr<SymbolicFile *>
-SymbolicFile::createSymbolicFile(MemoryBuffer *Object, sys::fs::file_magic Type,
+SymbolicFile::createSymbolicFile(std::unique_ptr<MemoryBuffer> &Object,
+ sys::fs::file_magic Type,
LLVMContext *Context) {
if (Type == sys::fs::file_magic::unknown)
Type = sys::fs::identify_magic(Object->getBuffer());
@@ -33,7 +34,7 @@ SymbolicFile::createSymbolicFile(MemoryB
switch (Type) {
case sys::fs::file_magic::bitcode:
if (Context)
- return IRObjectFile::createIRObjectFile(Object, *Context);
+ return IRObjectFile::createIRObjectFile(Object.release(), *Context);
// Fallthrough
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::archive:
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Mon Jun 23 17:00:37 2014
@@ -685,7 +685,7 @@ static void writeStringTable(raw_fd_ostr
static void
writeSymbolTable(raw_fd_ostream &Out, ArrayRef<NewArchiveIterator> Members,
- ArrayRef<std::unique_ptr<MemoryBuffer>> Buffers,
+ MutableArrayRef<std::unique_ptr<MemoryBuffer>> Buffers,
std::vector<std::pair<unsigned, unsigned>> &MemberOffsetRefs) {
unsigned StartOffset = 0;
unsigned MemberNum = 0;
@@ -696,7 +696,7 @@ writeSymbolTable(raw_fd_ostream &Out, Ar
for (ArrayRef<NewArchiveIterator>::iterator I = Members.begin(),
E = Members.end();
I != E; ++I, ++MemberNum) {
- MemoryBuffer *MemberBuffer = Buffers[MemberNum].get();
+ std::unique_ptr<MemoryBuffer> &MemberBuffer = Buffers[MemberNum];
ErrorOr<object::SymbolicFile *> ObjOrErr =
object::SymbolicFile::createSymbolicFile(
MemberBuffer, sys::fs::file_magic::unknown, &Context);
@@ -724,7 +724,7 @@ writeSymbolTable(raw_fd_ostream &Out, Ar
MemberOffsetRefs.push_back(std::make_pair(Out.tell(), MemberNum));
print32BE(Out, 0);
}
- Obj->releaseBuffer();
+ MemberBuffer.reset(Obj->releaseBuffer());
}
Out << NameOS.str();
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Mon Jun 23 17:00:37 2014
@@ -73,7 +73,7 @@ static void DumpInput(const StringRef &F
return;
}
- ErrorOr<ObjectFile*> ObjOrErr(ObjectFile::createObjectFile(Buff.release()));
+ ErrorOr<ObjectFile *> ObjOrErr(ObjectFile::createObjectFile(Buff));
if (std::error_code EC = ObjOrErr.getError()) {
errs() << Filename << ": " << EC.message() << '\n';
return;
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Mon Jun 23 17:00:37 2014
@@ -726,7 +726,7 @@ static void dumpSymbolNamesFromFile(std:
return;
LLVMContext &Context = getGlobalContext();
- ErrorOr<Binary *> BinaryOrErr = createBinary(Buffer.get(), &Context);
+ ErrorOr<Binary *> BinaryOrErr = createBinary(Buffer, &Context);
if (error(BinaryOrErr.getError(), Filename))
return;
Buffer.release();
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=211546&r1=211545&r2=211546&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Mon Jun 23 17:00:37 2014
@@ -203,7 +203,7 @@ void llvm::DisassembleInputMachO(StringR
}
std::unique_ptr<MachOObjectFile> MachOOF(static_cast<MachOObjectFile *>(
- ObjectFile::createMachOObjectFile(Buff.release()).get()));
+ ObjectFile::createMachOObjectFile(Buff).get()));
DisassembleInputMachO2(Filename, MachOOF.get());
}
@@ -293,7 +293,7 @@ static void DisassembleInputMachO2(Strin
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
return;
}
- DbgObj = ObjectFile::createMachOObjectFile(Buf.release()).get();
+ DbgObj = ObjectFile::createMachOObjectFile(Buf).get();
}
// Setup the DIContext
More information about the llvm-commits
mailing list