r269549 - Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC""
Chandler Carruth via cfe-commits
cfe-commits at lists.llvm.org
Fri May 13 22:39:46 PDT 2016
Author: chandlerc
Date: Sat May 14 00:39:45 2016
New Revision: 269549
URL: http://llvm.org/viewvc/llvm-project?rev=269549&view=rev
Log:
Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269492 as the corresponding LLVM commit was
reverted due to lots of warnings. See the review thread for the original
LLVM commit (r269491) for details.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269549&r1=269548&r2=269549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat May 14 00:39:45 2016
@@ -141,13 +141,11 @@ CodeGenModule::CodeGenModule(ASTContext
if (CodeGenOpts.hasProfileClangUse()) {
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
CodeGenOpts.ProfileInstrumentUsePath);
- if (auto E = ReaderOrErr.takeError()) {
+ if (std::error_code EC = ReaderOrErr.getError()) {
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
"Could not read profile %0: %1");
- llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
- getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
- << EI.message();
- });
+ getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+ << EC.message();
} else
PGOReader = std::move(ReaderOrErr.get());
}
Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269549&r1=269548&r2=269549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Sat May 14 00:39:45 2016
@@ -800,21 +800,20 @@ void CodeGenPGO::loadRegionCounts(llvm::
bool IsInMainFile) {
CGM.getPGOStats().addVisited(IsInMainFile);
RegionCounts.clear();
- llvm::Expected<llvm::InstrProfRecord> RecordExpected =
+ llvm::ErrorOr<llvm::InstrProfRecord> RecordErrorOr =
PGOReader->getInstrProfRecord(FuncName, FunctionHash);
- if (auto E = RecordExpected.takeError()) {
- auto IPE = llvm::InstrProfError::take(std::move(E));
- if (IPE == llvm::instrprof_error::unknown_function)
+ if (std::error_code EC = RecordErrorOr.getError()) {
+ if (EC == llvm::instrprof_error::unknown_function)
CGM.getPGOStats().addMissing(IsInMainFile);
- else if (IPE == llvm::instrprof_error::hash_mismatch)
+ else if (EC == llvm::instrprof_error::hash_mismatch)
CGM.getPGOStats().addMismatched(IsInMainFile);
- else if (IPE == llvm::instrprof_error::malformed)
+ else if (EC == 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(RecordExpected.get()));
+ llvm::make_unique<llvm::InstrProfRecord>(std::move(RecordErrorOr.get()));
RegionCounts = ProfRecord->Counts;
}
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269549&r1=269548&r2=269549&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat May 14 00:39:45 2016
@@ -403,8 +403,7 @@ static void setPGOUseInstrumentor(CodeGe
const std::string ProfileName) {
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
// In error, return silently and let Clang PGOUse report the error message.
- if (auto E = ReaderOrErr.takeError()) {
- llvm::consumeError(std::move(E));
+ if (ReaderOrErr.getError()) {
Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
return;
}
More information about the cfe-commits
mailing list