[llvm] [profdata] Consume reader error if returned early (PR #163671)

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 27 11:25:05 PDT 2025


================
@@ -778,6 +779,12 @@ loadInput(const WeightedFile &Input, SymbolRemapper *Remapper,
   // we have more non-fatal errors from InstrProfReader in the future. How
   // should this interact with different -failure-mode?
   std::optional<std::pair<Error, std::string>> ReaderWarning;
+  auto ReaderWarningScope = llvm::make_scope_exit([&] {
+    // If we hit a different error we may still have an error in ReaderWarning.
+    // Consume it now to avoid an assert
+    if (ReaderWarning)
+      consumeError(std::move(ReaderWarning->first));
+  });
----------------
ZequanWu wrote:

Yeah, that's a problem.

https://github.com/llvm/llvm-project/pull/163671


More information about the llvm-commits mailing list