diff options
| author | Vedant Kumar <vsk@apple.com> | 2016-05-13 21:51:02 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2016-05-13 21:51:02 +0000 |
| commit | 0b7b7ae806e055c775930cca515f226b8600f9f2 (patch) | |
| tree | fd1ca991deb9680fdba70a714fb62daf63e16afa /clang/lib/CodeGen/CodeGenPGO.cpp | |
| parent | df41bd89a56d03aa88cdfc2f8b1255f8ed3fbeca (diff) | |
| download | bcm5719-llvm-0b7b7ae806e055c775930cca515f226b8600f9f2.tar.gz bcm5719-llvm-0b7b7ae806e055c775930cca515f226b8600f9f2.zip | |
Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"
Sync up with "(llvm) Use Error in InstrProf and Coverage".
Differential Revision: http://reviews.llvm.org/D19902
llvm-svn: 269492
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 43bc37c49f7..c19321b5129 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -800,20 +800,21 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader, bool IsInMainFile) { CGM.getPGOStats().addVisited(IsInMainFile); RegionCounts.clear(); - llvm::ErrorOr<llvm::InstrProfRecord> RecordErrorOr = + llvm::Expected<llvm::InstrProfRecord> RecordExpected = PGOReader->getInstrProfRecord(FuncName, FunctionHash); - if (std::error_code EC = RecordErrorOr.getError()) { - if (EC == llvm::instrprof_error::unknown_function) + if (auto E = RecordExpected.takeError()) { + auto IPE = llvm::InstrProfError::take(std::move(E)); + if (IPE == llvm::instrprof_error::unknown_function) CGM.getPGOStats().addMissing(IsInMainFile); - else if (EC == llvm::instrprof_error::hash_mismatch) + else if (IPE == llvm::instrprof_error::hash_mismatch) CGM.getPGOStats().addMismatched(IsInMainFile); - else if (EC == llvm::instrprof_error::malformed) + else if (IPE == llvm::instrprof_error::malformed) // TODO: Consider a more specific warning for this case. CGM.getPGOStats().addMismatched(IsInMainFile); return; } ProfRecord = - llvm::make_unique<llvm::InstrProfRecord>(std::move(RecordErrorOr.get())); + llvm::make_unique<llvm::InstrProfRecord>(std::move(RecordExpected.get())); RegionCounts = ProfRecord->Counts; } |

