[clang] [CIR] Upstream Exception ThrowOp with subexpr (PR #161818)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 6 12:55:03 PDT 2025


================
@@ -178,3 +178,36 @@ void CIRGenFunction::popCleanupBlocks(
     popCleanupBlock();
   }
 }
+
+void CIRGenFunction::deactivateCleanupBlock(
+    EHScopeStack::stable_iterator cleanup, mlir::Operation *dominatingIP) {
+  assert(cleanup != ehStack.stable_end() && "deactivating bottom of stack?");
+  EHCleanupScope &scope = cast<EHCleanupScope>(*ehStack.find(cleanup));
+  assert(scope.isActive() && "double deactivation");
+
+  // If it's the top of the stack, just pop it, but do so only if it belongs
+  // to the current RunCleanupsScope.
+  if (cleanup == ehStack.stable_begin() &&
+      currentCleanupStackDepth.strictlyEncloses(cleanup)) {
+
+    // Per comment below, checking EHAsynch is not really necessary
----------------
AmrDeveloper wrote:

To be able to test that part, I will need to support cleanup also, so I removed `deactivateCleanupBlock` and will add it in the next PR with FreeExceptionOp

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


More information about the cfe-commits mailing list