[clang] [WinEH] Fix crash, object unwinding in the except block (PR #172287)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 22 03:00:46 PST 2026


================
@@ -2212,8 +2212,14 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
   const VarDecl &D = *emission.Variable;
 
   // Check the type for a cleanup.
-  if (QualType::DestructionKind dtorKind = D.needsDestruction(getContext()))
+  if (QualType::DestructionKind dtorKind = D.needsDestruction(getContext())) {
+    // Check if we're in a SEH block and this is a C++ destructor
+    if (dtorKind == QualType::DK_cxx_destructor)
----------------
GkvJwa wrote:

Review again

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


More information about the cfe-commits mailing list