summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-03-30 23:10:39 +0000
committerPete Cooper <peter_cooper@apple.com>2016-03-30 23:10:39 +0000
commitfefbd22814ce5ed3928cc38ad6be1bf7de013905 (patch)
treeec24b8690147ead2148f984b11ce77bfcdda5d2c /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
parent3fb963389e42941273d9c4eaa829fec8f18867c7 (diff)
downloadbcm5719-llvm-fefbd22814ce5ed3928cc38ad6be1bf7de013905.tar.gz
bcm5719-llvm-fefbd22814ce5ed3928cc38ad6be1bf7de013905.zip
Convert lld file writing to llvm::Error. NFC.
This converts the writeFile method, as well as some of the ones it calls in the normalized binary file writer and yaml writer. llvm-svn: 264961
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index f85dbba9d6e..b8c739627c4 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -133,7 +133,7 @@ public:
/// Writes the normalized file as a binary mach-o file to the specified
/// path. This does not have a stream interface because the generated
/// file may need the 'x' bit set.
- std::error_code writeBinary(StringRef path);
+ llvm::Error writeBinary(StringRef path);
private:
uint32_t loadCommandsSize(uint32_t &count);
@@ -1459,10 +1459,10 @@ void MachOFileLayout::writeLinkEditContent() {
}
}
-std::error_code MachOFileLayout::writeBinary(StringRef path) {
+llvm::Error MachOFileLayout::writeBinary(StringRef path) {
// Check for pending error from constructor.
if (_ec)
- return _ec;
+ return llvm::errorCodeToError(_ec);
// Create FileOutputBuffer with calculated size.
unsigned flags = 0;
if (_file.fileType != llvm::MachO::MH_OBJECT)
@@ -1470,23 +1470,23 @@ std::error_code MachOFileLayout::writeBinary(StringRef path) {
ErrorOr<std::unique_ptr<llvm::FileOutputBuffer>> fobOrErr =
llvm::FileOutputBuffer::create(path, size(), flags);
if (std::error_code ec = fobOrErr.getError())
- return ec;
+ return llvm::errorCodeToError(ec);
std::unique_ptr<llvm::FileOutputBuffer> &fob = *fobOrErr;
// Write content.
_buffer = fob->getBufferStart();
writeMachHeader();
std::error_code ec = writeLoadCommands();
if (ec)
- return ec;
+ return llvm::errorCodeToError(ec);
writeSectionContent();
writeLinkEditContent();
fob->commit();
- return std::error_code();
+ return llvm::Error();
}
/// Takes in-memory normalized view and writes a mach-o object file.
-std::error_code writeBinary(const NormalizedFile &file, StringRef path) {
+llvm::Error writeBinary(const NormalizedFile &file, StringRef path) {
MachOFileLayout layout(file);
return layout.writeBinary(path);
}
OpenPOWER on IntegriCloud