================
@@ -9099,9 +9099,10 @@ void CGOpenMPRuntime::emitUserDefinedMapper(const 
OMPDeclareMapperDecl *D,
   CGM.getCXXABI().getMangleContext().mangleCanonicalTypeName(Ty, Out);
   std::string Name = getName({"omp_mapper", TyStr, D->getName()});
 
-  auto *NewFn = OMPBuilder.emitUserDefinedMapper(PrivatizeAndGenMapInfoCB,
-                                                 ElemTy, Name, CustomMapperCB);
-  UDMMap.try_emplace(D, NewFn);
+  llvm::Expected<llvm::Function *> NewFn = OMPBuilder.emitUserDefinedMapper(
+      PrivatizeAndGenMapInfoCB, ElemTy, Name, CustomMapperCB);
+  assert(NewFn && "Unexpected error in emitUserDefinedMapper");
----------------
skatrak wrote:

Wrap the call to `OMPBuilder.emitUserDefinedMapper` with `llvm::cantFail()` 
instead, which would consume and discard the error. Doing it with an assert has 
the problem that it will always crash if assertions are off, regardless of 
errors.

In clang, the error handling process involves early process exit during 
execution of the callback, which allows us to just assume there are no errors 
here. In MLIR to LLVM IR translation, however, we have to forward or handle 
errors so we can exit gracefully.

https://github.com/llvm/llvm-project/pull/124746
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to