Skip to content

Commit f8d6f05

Browse files
committed
[profdata] Consume reader error if returned early
1 parent 19a58a5 commit f8d6f05

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/tools/llvm-profdata/llvm-profdata.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "llvm/ADT/ScopeExit.h"
1314
#include "llvm/ADT/SmallSet.h"
1415
#include "llvm/ADT/SmallVector.h"
1516
#include "llvm/ADT/StringRef.h"
@@ -778,6 +779,10 @@ loadInput(const WeightedFile &Input, SymbolRemapper *Remapper,
778779
// we have more non-fatal errors from InstrProfReader in the future. How
779780
// should this interact with different -failure-mode?
780781
std::optional<std::pair<Error, std::string>> ReaderWarning;
782+
auto ReaderWarningScope = llvm::make_scope_exit([&] {
783+
if (ReaderWarning)
784+
consumeError(std::move(ReaderWarning->first));
785+
});
781786
auto Warn = [&](Error E) {
782787
if (ReaderWarning) {
783788
consumeError(std::move(E));

0 commit comments

Comments
 (0)