Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"

Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

Differential Revision: http://reviews.llvm.org/D19901

llvm-svn: 269491
This commit is contained in:
Vedant Kumar
2016-05-13 21:50:56 +00:00
parent 5a625be808
commit df41bd89a5
18 changed files with 606 additions and 503 deletions

View File

@@ -210,10 +210,9 @@ std::unique_ptr<CoverageMapping> CodeCoverageTool::load() {
errs() << "warning: profile data may be out of date - object is newer\n";
auto CoverageOrErr = CoverageMapping::load(ObjectFilename, PGOFilename,
CoverageArch);
if (std::error_code EC = CoverageOrErr.getError()) {
if (Error E = CoverageOrErr.takeError()) {
colored_ostream(errs(), raw_ostream::RED)
<< "error: Failed to load coverage: " << EC.message();
errs() << "\n";
<< "error: Failed to load coverage: " << toString(std::move(E)) << "\n";
return nullptr;
}
auto Coverage = std::move(CoverageOrErr.get());