summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-05-13 20:10:22 +0000
committerVedant Kumar <vsk@apple.com>2016-05-13 20:10:22 +0000
commit2d87639c5acbd122261574226c570971b54ef61e (patch)
tree962bedac1fb0e18378448d98b8102c53792ee959 /clang/lib
parent064535c1eace2b43f3f628f43551422fb5d054f5 (diff)
downloadbcm5719-llvm-2d87639c5acbd122261574226c570971b54ef61e.tar.gz
bcm5719-llvm-2d87639c5acbd122261574226c570971b54ef61e.zip
Revert "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"
This reverts commit r269463. It fails two llvm-profdata tests. llvm-svn: 269468
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp13
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
3 files changed, 10 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 57a6429c4be..79da25c13fa 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -141,13 +141,11 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
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());
}
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index c19321b5129..43bc37c49f7 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -800,21 +800,20 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader,
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;
}
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 20b66906d56..8e93ff1a4b4 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -403,8 +403,7 @@ static void setPGOUseInstrumentor(CodeGenOptions &Opts,
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;
}
OpenPOWER on IntegriCloud