https://github.com/GkvJwa updated 
https://github.com/llvm/llvm-project/pull/180108

>From eb6dae98ee28b20ddcd01fc387b1c432f39fb1fc Mon Sep 17 00:00:00 2001
From: GkvJwa <[email protected]>
Date: Fri, 6 Feb 2026 11:21:17 +0800
Subject: [PATCH 1/2] Check enable eha

---
 clang/lib/CodeGen/CGDecl.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index c66112e0e5bfb..b470f48ccd911 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -2228,8 +2228,8 @@ void CodeGenFunction::EmitAutoVarCleanups(const 
AutoVarEmission &emission) {
 
   // Check the type for a cleanup.
   if (QualType::DestructionKind dtorKind = D.needsDestruction(getContext())) {
-    // Check if we're in a SEH block, prevent it
-    if (currentFunctionUsesSEHTry())
+    // Check if we're in a SEH block with EHa, prevent it
+    if (getLangOpts().EHAsynch && currentFunctionUsesSEHTry())
       getContext().getDiagnostics().Report(D.getLocation(),
                                            diag::err_seh_object_unwinding);
     emitAutoVarTypeCleanup(emission, dtorKind);

>From fe9977a194caebe3b9a682bf6c6c4c1b945c7cac Mon Sep 17 00:00:00 2001
From: GkvJwa <[email protected]>
Date: Sat, 7 Feb 2026 20:27:41 +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

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to