[lld] r216003 - Update for llvm api change.
Rafael Espindola
rafael.espindola at gmail.com
Tue Aug 19 11:44:52 PDT 2014
Author: rafael
Date: Tue Aug 19 13:44:51 2014
New Revision: 216003
URL: http://llvm.org/viewvc/llvm-project?rev=216003&view=rev
Log:
Update for llvm api change.
Modified:
lld/trunk/lib/ReaderWriter/FileArchive.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=216003&r1=216002&r2=216003&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Tue Aug 19 13:44:51 2014
@@ -57,11 +57,15 @@ public:
return nullptr;
if (dataSymbolOnly) {
- ErrorOr<std::unique_ptr<MemoryBuffer>> buffOrErr =
- ci->getMemoryBuffer(true);
+ ErrorOr<llvm::MemoryBufferRef> buffOrErr = ci->getMemoryBufferRef();
if (buffOrErr.getError())
return nullptr;
- if (isDataSymbol(std::move(buffOrErr.get()), name))
+
+ llvm::MemoryBufferRef mb = buffOrErr.get();
+ std::unique_ptr<MemoryBuffer> buff(MemoryBuffer::getMemBuffer(
+ mb.getBuffer(), mb.getBufferIdentifier(), false));
+
+ if (isDataSymbol(std::move(buff), name))
return nullptr;
}
@@ -136,14 +140,17 @@ protected:
std::error_code
instantiateMember(Archive::child_iterator member,
std::vector<std::unique_ptr<File>> &result) const {
- ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr =
- member->getMemoryBuffer(true);
+ ErrorOr<llvm::MemoryBufferRef> mbOrErr = member->getMemoryBufferRef();
if (std::error_code ec = mbOrErr.getError())
return ec;
- std::unique_ptr<MemoryBuffer> mb = std::move(mbOrErr.get());
+ llvm::MemoryBufferRef mb = mbOrErr.get();
if (_logLoading)
- llvm::outs() << mb->getBufferIdentifier() << "\n";
- _registry.parseFile(mb, result);
+ llvm::outs() << mb.getBufferIdentifier() << "\n";
+
+ std::unique_ptr<MemoryBuffer> buf(MemoryBuffer::getMemBuffer(
+ mb.getBuffer(), mb.getBufferIdentifier(), false));
+
+ _registry.parseFile(buf, result);
const char *memberStart = member->getBuffer().data();
_membersInstantiated.insert(memberStart);
return std::error_code();
@@ -154,7 +161,7 @@ protected:
// symbol or does not exist, returns a failure.
std::error_code isDataSymbol(std::unique_ptr<MemoryBuffer> mb,
StringRef symbol) const {
- auto objOrErr(ObjectFile::createObjectFile(mb));
+ auto objOrErr(ObjectFile::createObjectFile(mb->getMemBufferRef()));
if (auto ec = objOrErr.getError())
return ec;
std::unique_ptr<ObjectFile> obj = std::move(objOrErr.get());
@@ -218,7 +225,7 @@ public:
MemoryBuffer &buff = *mb;
// Make Archive object which will be owned by FileArchive object.
std::error_code ec;
- Archive *archive = new Archive(std::move(mb), ec);
+ Archive *archive = new Archive(mb->getMemBufferRef(), ec);
if (ec)
return ec;
StringRef path = buff.getBufferIdentifier();
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=216003&r1=216002&r2=216003&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Tue Aug 19 13:44:51 2014
@@ -144,6 +144,7 @@ private:
StringRef ArrayRefToString(ArrayRef<uint8_t> array);
std::unique_ptr<const llvm::object::COFFObjectFile> _obj;
+ std::unique_ptr<MemoryBuffer> _mb;
atom_collection_vector<DefinedAtom> _definedAtoms;
atom_collection_vector<UndefinedAtom> _undefinedAtoms;
atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
@@ -287,9 +288,9 @@ DefinedAtom::Merge getMerge(const coff_a
}
FileCOFF::FileCOFF(std::unique_ptr<MemoryBuffer> mb, std::error_code &ec)
- : File(mb->getBufferIdentifier(), kindObject), _compatibleWithSEH(false),
- _ordinal(0) {
- auto binaryOrErr = llvm::object::createBinary(std::move(mb));
+ : File(mb->getBufferIdentifier(), kindObject), _mb(std::move(mb)),
+ _compatibleWithSEH(false), _ordinal(0) {
+ auto binaryOrErr = llvm::object::createBinary(_mb->getMemBufferRef());
if ((ec = binaryOrErr.getError()))
return;
std::unique_ptr<llvm::object::Binary> bin = std::move(binaryOrErr.get());
More information about the llvm-commits
mailing list