llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (GkvJwa) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/180959.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CGDecl.cpp (+4-2) - (modified) clang/test/CodeGenCXX/exceptions-seh.cpp (+9) ``````````diff diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index b470f48ccd911..81697e02e8f3f 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -2228,8 +2228,10 @@ 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 with EHa, prevent it - if (getLangOpts().EHAsynch && currentFunctionUsesSEHTry()) + // Check if we're in a SEH block with /EH, prevent it + // TODO: /EHs* differs from /EHa, the former may not be executed to this + // point. + if (getLangOpts().CXXExceptions && currentFunctionUsesSEHTry()) getContext().getDiagnostics().Report(D.getLocation(), diag::err_seh_object_unwinding); emitAutoVarTypeCleanup(emission, dtorKind); diff --git a/clang/test/CodeGenCXX/exceptions-seh.cpp b/clang/test/CodeGenCXX/exceptions-seh.cpp index 0716ed7ee81d6..0afabd788146a 100644 --- a/clang/test/CodeGenCXX/exceptions-seh.cpp +++ b/clang/test/CodeGenCXX/exceptions-seh.cpp @@ -12,6 +12,8 @@ // 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 +// RUN: %clang_cc1 -triple x86_64-windows \ +// RUN: -fms-extensions -x c++ -emit-llvm-only -verify %s -DERR5 extern "C" unsigned long _exception_code(); extern "C" void might_throw(); @@ -206,6 +208,13 @@ void seh_unwinding() { } } #elif defined(ERR4) +void seh_unwinding() { + __try { + HasCleanup x; // expected-error{{'__try' is not permitted in functions that require object unwinding}} + } __except (1) { + } +} +#elif defined(ERR5) void seh_unwinding() { __try { HasCleanup x; // expected-no-diagnostics `````````` </details> https://github.com/llvm/llvm-project/pull/180959 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
