[PATCH] D99457: [llvm-profdata] Make sure to consume Error on the error path of setIsIRLevelProfile

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 27 10:05:57 PDT 2021


zero9178 created this revision.
zero9178 added reviewers: vsk, davidxl.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Encountered a crash while running a debug build, where this code path would be taken due to a mismatch in profile coverage data versions. Without consuming the error, an assert would be triggered inside the destructor of Error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99457

Files:
  llvm/tools/llvm-profdata/llvm-profdata.cpp


Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===================================================================
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -251,7 +251,8 @@
   auto Reader = std::move(ReaderOrErr.get());
   bool IsIRProfile = Reader->isIRLevelProfile();
   bool HasCSIRProfile = Reader->hasCSIRLevelProfile();
-  if (WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
+  if (Error E = WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
+    consumeError(std::move(E));
     WC->Errors.emplace_back(
         make_error<StringError>(
             "Merge IR generated profile with Clang generated profile.",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99457.333675.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210327/1ad3166b/attachment.bin>


More information about the llvm-commits mailing list