[clang] [llvm] [mlir] [OpenMP][OMPIRBuilder] Error propagation across callbacks (PR #112533)

Sergio Afonso via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 23 05:06:52 PDT 2024


================
@@ -1496,7 +1507,8 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
   // Let the caller create the body.
   assert(BodyGenCB && "Expected body generation callback!");
   InsertPointTy CodeGenIP(PRegBodyBB, PRegBodyBB->begin());
-  BodyGenCB(InnerAllocaIP, CodeGenIP);
+  if (Error Err = BodyGenCB(InnerAllocaIP, CodeGenIP))
+    return std::move(Err);
----------------
skatrak wrote:

It looks like it works as expected in this case as well (if it created a copy it would be triggering runtime failures). I see `Expected` has an implicit move constructor for an `Error` argument, so perhaps that's what's enabling this.

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


More information about the cfe-commits mailing list