summaryrefslogtreecommitdiffstats
path: root/lld/lib/Passes/RoundTripYAMLPass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/Passes/RoundTripYAMLPass.cpp')
-rw-r--r--lld/lib/Passes/RoundTripYAMLPass.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lld/lib/Passes/RoundTripYAMLPass.cpp b/lld/lib/Passes/RoundTripYAMLPass.cpp
index 9bb09e7d5b3..d96341fe8b0 100644
--- a/lld/lib/Passes/RoundTripYAMLPass.cpp
+++ b/lld/lib/Passes/RoundTripYAMLPass.cpp
@@ -37,11 +37,12 @@ void RoundTripYAMLPass::perform(std::unique_ptr<MutableFile> &mergedFile) {
// The file that is written would be kept around if there is a problem
// writing to the file or when reading atoms back from the file.
yamlWriter->writeFile(*mergedFile, tmpYAMLFile.str());
- std::unique_ptr<MemoryBuffer> mb;
- if (MemoryBuffer::getFile(tmpYAMLFile.str(), mb))
+ ErrorOr<std::unique_ptr<MemoryBuffer>> mb =
+ MemoryBuffer::getFile(tmpYAMLFile.str());
+ if (!mb)
return;
- std::error_code ec = _context.registry().parseFile(mb, _yamlFile);
+ std::error_code ec = _context.registry().parseFile(mb.get(), _yamlFile);
if (ec) {
// Note: we need a way for Passes to report errors.
llvm_unreachable("yaml reader not registered or read error");
OpenPOWER on IntegriCloud