[clang] [WinEH] Fix object delete crash (PR #180144)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 7 04:24:19 PST 2026
https://github.com/GkvJwa updated https://github.com/llvm/llvm-project/pull/180144
>From 6fc5496ed0cf55d366678c45130da69b7a4cfc51 Mon Sep 17 00:00:00 2001
From: GkvJwa <gkvjwa at gmail.com>
Date: Fri, 6 Feb 2026 17:01:43 +0800
Subject: [PATCH 1/2] Test
---
clang/lib/CodeGen/CGCleanup.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp
index 28ac9bf396356..f64995511fd88 100644
--- a/clang/lib/CodeGen/CGCleanup.cpp
+++ b/clang/lib/CodeGen/CGCleanup.cpp
@@ -813,8 +813,6 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough,
if (IsEHa && getInvokeDest()) {
if (Personality.isMSVCXXPersonality())
EmitSehCppScopeEnd();
- else
- EmitSehTryScopeEnd();
}
destroyOptimisticNormalEntry(*this, Scope);
>From d1b95e2ee704584394ccf125931067a173897052 Mon Sep 17 00:00:00 2001
From: GkvJwa <gkvjwa at gmail.com>
Date: Sat, 7 Feb 2026 20:24:03 +0800
Subject: [PATCH 2/2] Add no diagnostics
---
clang/test/CodeGenCXX/exceptions-seh.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/clang/test/CodeGenCXX/exceptions-seh.cpp b/clang/test/CodeGenCXX/exceptions-seh.cpp
index 7ccd17fa73bbd..f8078b21fc7a6 100644
--- a/clang/test/CodeGenCXX/exceptions-seh.cpp
+++ b/clang/test/CodeGenCXX/exceptions-seh.cpp
@@ -10,6 +10,8 @@
// RUN: -fms-extensions -x c++ -emit-llvm-only -verify %s -DERR2
// RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions \
// RUN: -fms-extensions -x c++ -emit-llvm-only -verify %s -DERR3
+// RUN: %clang_cc1 -triple x86_64-windows -fcxx-exceptions -fexceptions \
+// RUN: -fms-extensions -x c++ -emit-llvm-only -verify %s -DERR4
extern "C" unsigned long _exception_code();
extern "C" void might_throw();
@@ -203,4 +205,11 @@ void seh_unwinding() {
} __except (1) {
}
}
+#elif defined(ERR4)
+void seh_unwinding() {
+ HasCleanup x; // expected-no-diagnostics
+ __try {
+ } __except (1) {
+ }
+}
#endif
More information about the cfe-commits
mailing list