[clang] [CIR] Implement handling for lambda capture of destructured types (PR #191316)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 10 11:53:34 PDT 2026
================
@@ -300,7 +303,7 @@ static void emitCleanup(CIRGenFunction &cgf, cir::CleanupScopeOp cleanupScope,
}
}
-void CIRGenFunction::popCleanupBlock() {
+void CIRGenFunction::popCleanupBlock(bool forDeactivation) {
----------------
andykaylor wrote:
I'll add a comment, but to summarize here deactivation is a concept in the EH stack design and this concept is shared with classic codegen. A stack entry is deactivated when its cleanup should no longer be run. If the cleanup is at the top of the stack, it is simply popped, but if it's not at the top of the stack we add a flag variable that is checked to see whether or not the cleanup should actually be run.
For some more context, I introduced the `deactivateCleanupBlock` function here: https://github.com/llvm/llvm-project/pull/184707
And added support for the case where the cleanup being deactivated isn't at the top of the stack here: https://github.com/llvm/llvm-project/pull/187389
The parameter I'm adding here is used in the case where the cleanup we're deactivating is at the top of the stack and we are popping it. Classic codegen also has this parameter, so you can look there as a point of comparison. This was pretty tricky to get right for CIR. When we deactivate a cleanup, we don't want "normal" cleanup to be run or we'd get double frees, but EH cleanups still need to be run.
https://github.com/llvm/llvm-project/pull/191316
More information about the cfe-commits
mailing list