diff options
Diffstat (limited to 'lib/IR/GCOV.cpp')
-rw-r--r-- | lib/IR/GCOV.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index f2099d6..1667401 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -19,8 +19,8 @@ #include "llvm/Support/Format.h" #include "llvm/Support/MemoryObject.h" #include "llvm/Support/Path.h" -#include "llvm/Support/system_error.h" #include <algorithm> +#include <system_error> using namespace llvm; //===----------------------------------------------------------------------===// @@ -438,11 +438,15 @@ class LineConsumer { StringRef Remaining; public: LineConsumer(StringRef Filename) { - if (error_code EC = MemoryBuffer::getFileOrSTDIN(Filename, Buffer)) { + ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = + MemoryBuffer::getFileOrSTDIN(Filename); + if (std::error_code EC = BufferOrErr.getError()) { errs() << Filename << ": " << EC.message() << "\n"; Remaining = ""; - } else + } else { + Buffer = std::move(BufferOrErr.get()); Remaining = Buffer->getBuffer(); + } } bool empty() { return Remaining.empty(); } void printNext(raw_ostream &OS, uint32_t LineNum) { |