================
@@ -234,7 +234,11 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s,
   case Stmt::ContinueStmtClass:
   case Stmt::DeclStmtClass:
   case Stmt::ReturnStmtClass:
-    llvm_unreachable("should have emitted these statements as simple");
+    // emitSimpleStmt handles all of these directly, except when there is a
+    // failure. That can happen for CompoundStmtClass when one of its children
+    // is e.g. a not-yet-implemented construct, so we need to propagate the
+    // error.
+    return mlir::failure();
----------------
andykaylor wrote:

I don't like this change. The purpose of the unreachable (which is copied from 
classic) is to alert us to the fact that something got here that we didn't 
expect to get here. We'd want that in the long run. Returning failure() here 
ends up getting silently ignored. I understand that's what you want in the case 
where we've already reported an NYI diagnostic, but that's a temporary state of 
the implementation and frankly failing gracefully after it has happened doesn't 
seem to me to have any practical value. I wouldn't want to silence the guard 
here just to be more graceful about known failure points.

If you want to silently pass on failures that have already been reported, 
perhaps we can add some mechanism to detect the difference between "a error was 
reported" and "we didn't handle this statement kind".

https://github.com/llvm/llvm-project/pull/236184
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to