[clang] [CIR] Represent Cleanups with Cleanup scopes (PR #180276)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 18 11:13:03 PST 2026


================
@@ -391,6 +394,13 @@ mlir::LogicalResult CIRGenFunction::emitCXXTryStmt(const CXXTryStmt &s) {
 
     // Fall out through the catch cleanups.
     handlerScope.forceCleanup();
+
+    mlir::Block *block = &handler->getBlocks().back();
+    if (block->empty() ||
+        !block->back().hasTrait<mlir::OpTrait::IsTerminator>()) {
+      builder.setInsertionPointToEnd(block);
----------------
andykaylor wrote:

Do you need an insertion point guard here? This leaves the insertion point inside the handler region.

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


More information about the cfe-commits mailing list