X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FGCOV.cpp;h=1667401f88d0c1bed672d21e530a65d5541ad83b;hb=d2ea3168ae9117324582210007a18ffc31fb6586;hp=e8d26e0d9e155a1adda5b22a31976f970d5213b9;hpb=88ab50c23791442f13c72e331f0505f9fbb5046a;p=oota-llvm.git diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index e8d26e0d9e1..1667401f88d 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 +#include using namespace llvm; //===----------------------------------------------------------------------===// @@ -438,11 +438,15 @@ class LineConsumer { StringRef Remaining; public: LineConsumer(StringRef Filename) { - if (error_code EC = MemoryBuffer::getFileOrSTDIN(Filename, Buffer)) { + ErrorOr> 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) { @@ -511,16 +515,14 @@ std::string FileInfo::getCoveragePath(StringRef Filename, std::unique_ptr FileInfo::openCoveragePath(StringRef CoveragePath) { if (Options.NoOutput) - return make_unique(); + return llvm::make_unique(); std::string ErrorInfo; - // FIXME: When using MSVS, we end up having both std::make_unique and - // llvm::make_unique which conflict. Explicitly use the llvm:: version. auto OS = llvm::make_unique(CoveragePath.str().c_str(), ErrorInfo, sys::fs::F_Text); if (!ErrorInfo.empty()) { errs() << ErrorInfo << "\n"; - return make_unique(); + return llvm::make_unique(); } return std::move(OS); }