diff options
| author | Pete Cooper <peter_cooper@apple.com> | 2016-03-31 01:13:04 +0000 |
|---|---|---|
| committer | Pete Cooper <peter_cooper@apple.com> | 2016-03-31 01:13:04 +0000 |
| commit | 2f6216c1810628729ec8c2915a4ddd259b947c74 (patch) | |
| tree | 00099321f4b9627c112b040e5eb12d10da5e5ede /lld/lib | |
| parent | 45d0e238d5854d33facd8600cfe8e62556850d8a (diff) | |
| download | bcm5719-llvm-2f6216c1810628729ec8c2915a4ddd259b947c74.tar.gz bcm5719-llvm-2f6216c1810628729ec8c2915a4ddd259b947c74.zip | |
Use Expected<T> instead of ErrorOr<T>in yaml reader. NFC
llvm-svn: 264981
Diffstat (limited to 'lld/lib')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFile.h | 2 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h index 5f7584a3a40..92a21f7ef83 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h @@ -300,7 +300,7 @@ size_t headerAndLoadCommandsSize(const NormalizedFile &file); /// Parses a yaml encoded mach-o file to produce an in-memory normalized view. -ErrorOr<std::unique_ptr<NormalizedFile>> +llvm::Expected<std::unique_ptr<NormalizedFile>> readYaml(std::unique_ptr<MemoryBuffer> &mb); /// Writes a yaml encoded mach-o files given an in-memory normalized view. diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 51230cd3191..0b1e91927a8 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -800,7 +800,7 @@ bool MachOYamlIOTaggedDocumentHandler::handledDocTag(llvm::yaml::IO &io, namespace normalized { /// Parses a yaml encoded mach-o file to produce an in-memory normalized view. -ErrorOr<std::unique_ptr<NormalizedFile>> +llvm::Expected<std::unique_ptr<NormalizedFile>> readYaml(std::unique_ptr<MemoryBuffer> &mb) { // Make empty NormalizedFile. std::unique_ptr<NormalizedFile> f(new NormalizedFile()); @@ -814,8 +814,9 @@ readYaml(std::unique_ptr<MemoryBuffer> &mb) { yin >> *f; // Return error if there were parsing problems. - if (yin.error()) - return make_error_code(lld::YamlReaderError::illegal_value); + if (auto ec = yin.error()) + return llvm::make_error<GenericError>(Twine("YAML parsing error: ") + + ec.message()); // Hand ownership of instantiated NormalizedFile to caller. return std::move(f); |

