summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/WriterMachO.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/WriterMachO.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/WriterMachO.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/WriterMachO.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
index cce0a179608..972f987f60c 100644
--- a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
+++ b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
@@ -28,17 +28,18 @@ class MachOWriter : public Writer {
public:
MachOWriter(const MachOLinkingContext &ctxt) : _ctx(ctxt) {}
- std::error_code writeFile(const lld::File &file, StringRef path) override {
+ llvm::Error writeFile(const lld::File &file, StringRef path) override {
// Construct empty normalized file from atoms.
- ErrorOr<std::unique_ptr<NormalizedFile>> nFile =
+ llvm::Expected<std::unique_ptr<NormalizedFile>> nFile =
normalized::normalizedFromAtoms(file, _ctx);
- if (std::error_code ec = nFile.getError())
- return ec;
+ if (auto ec = nFile.takeError())
+ return std::move(ec);
// For testing, write out yaml form of normalized file.
if (_ctx.printAtoms()) {
std::unique_ptr<Writer> yamlWriter = createWriterYAML(_ctx);
- yamlWriter->writeFile(file, "-");
+ if (auto ec = yamlWriter->writeFile(file, "-"))
+ return std::move(ec);
}
// Write normalized file as mach-o binary.
OpenPOWER on IntegriCloud