[lld] r244849 - Update for llvm api change.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 17:31:46 PDT 2015
Author: rafael
Date: Wed Aug 12 19:31:46 2015
New Revision: 244849
URL: http://llvm.org/viewvc/llvm-project?rev=244849&view=rev
Log:
Update for llvm api change.
Modified:
lld/trunk/COFF/Writer.cpp
lld/trunk/ELF/Writer.cpp
lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=244849&r1=244848&r2=244849&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Wed Aug 12 19:31:46 2015
@@ -688,9 +688,10 @@ template <typename PEHeaderTy> void Writ
}
void Writer::openFile(StringRef Path) {
- std::error_code EC = FileOutputBuffer::create(Path, FileSize, Buffer,
- FileOutputBuffer::F_executable);
- error(EC, Twine("failed to open ") + Path);
+ ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
+ FileOutputBuffer::create(Path, FileSize, FileOutputBuffer::F_executable);
+ error(BufferOrErr, Twine("failed to open ") + Path);
+ Buffer = std::move(*BufferOrErr);
}
void Writer::fixSafeSEHSymbols() {
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=244849&r1=244848&r2=244849&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Aug 12 19:31:46 2015
@@ -255,9 +255,10 @@ template <class ELFT> void Writer<ELFT>:
}
template <class ELFT> void Writer<ELFT>::openFile(StringRef Path) {
- std::error_code EC = FileOutputBuffer::create(Path, FileSize, Buffer,
- FileOutputBuffer::F_executable);
- error(EC, Twine("failed to open ") + Path);
+ ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
+ FileOutputBuffer::create(Path, FileSize, FileOutputBuffer::F_executable);
+ error(BufferOrErr, Twine("failed to open ") + Path);
+ Buffer = std::move(*BufferOrErr);
}
// Write section contents to a mmap'ed file.
Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.cpp?rev=244849&r1=244848&r2=244849&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.cpp Wed Aug 12 19:31:46 2015
@@ -422,11 +422,14 @@ template <class ELFT> uint64_t OutputELF
template <class ELFT>
std::error_code OutputELFWriter<ELFT>::writeOutput(const File &file,
StringRef path) {
- std::unique_ptr<FileOutputBuffer> buffer;
+
ScopedTask createOutputTask(getDefaultDomain(), "ELF Writer Create Output");
- if (std::error_code ec = FileOutputBuffer::create(
- path, outputFileSize(), buffer, FileOutputBuffer::F_executable))
+ ErrorOr<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
+ FileOutputBuffer::create(path, outputFileSize(),
+ FileOutputBuffer::F_executable);
+ if (std::error_code ec = bufferOrErr.getError())
return ec;
+ std::unique_ptr<FileOutputBuffer> &buffer = *bufferOrErr;
createOutputTask.end();
ScopedTask writeTask(getDefaultDomain(), "ELF Writer write to memory");
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=244849&r1=244848&r2=244849&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Wed Aug 12 19:31:46 2015
@@ -1309,19 +1309,18 @@ std::error_code MachOFileLayout::writeBi
if (_ec)
return _ec;
// Create FileOutputBuffer with calculated size.
- std::unique_ptr<llvm::FileOutputBuffer> fob;
unsigned flags = 0;
if (_file.fileType != llvm::MachO::MH_OBJECT)
flags = llvm::FileOutputBuffer::F_executable;
- std::error_code ec;
- ec = llvm::FileOutputBuffer::create(path, size(), fob, flags);
- if (ec)
+ ErrorOr<std::unique_ptr<llvm::FileOutputBuffer>> fobOrErr =
+ llvm::FileOutputBuffer::create(path, size(), flags);
+ if (std::error_code ec = fobOrErr.getError())
return ec;
-
+ std::unique_ptr<llvm::FileOutputBuffer> &fob = *fobOrErr;
// Write content.
_buffer = fob->getBufferStart();
writeMachHeader();
- ec = writeLoadCommands();
+ std::error_code ec = writeLoadCommands();
if (ec)
return ec;
writeSectionContent();
More information about the llvm-commits
mailing list