Skip to content

Commit 16e29e4

Browse files
author
git apple-llvm automerger
committed
Merge commit '570c4c944338' from llvm.org/release/21.x into stable/21.x
2 parents d8e7cc7 + 570c4c9 commit 16e29e4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/CodeGen/TargetInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ TargetCodeGenInfo::~TargetCodeGenInfo() = default;
7575
// If someone can figure out a general rule for this, that would be great.
7676
// It's probably just doomed to be platform-dependent, though.
7777
unsigned TargetCodeGenInfo::getSizeOfUnwindException() const {
78+
if (getABIInfo().getContext().getLangOpts().hasSEHExceptions())
79+
return getABIInfo().getDataLayout().getPointerSizeInBits() > 32 ? 64 : 48;
7880
// Verified for:
7981
// x86-64 FreeBSD, Linux, Darwin
8082
// x86-32 FreeBSD, Linux, Darwin

clang/test/CodeGenCXX/sizeof-unwind-exception.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-DARWIN
44
// RUN: %clang_cc1 -triple arm-unknown-gnueabi -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-EABI
55
// RUN: %clang_cc1 -triple mipsel-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=MIPS
6+
// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -fcxx-exceptions -fexceptions -exception-model=seh %s -O2 -o - | FileCheck %s --check-prefix=MINGW-X86-64
7+
// RUN: %clang_cc1 -triple thumbv7-windows-gnu -emit-llvm -fcxx-exceptions -fexceptions -exception-model=seh %s -O2 -o - | FileCheck %s --check-prefix=MINGW-ARMV7
68

79
void foo();
810
void test() {
@@ -25,9 +27,15 @@ void test() {
2527
// ARM-EABI-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 88
2628
// MIPS: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
2729
// MIPS-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 24
30+
// MINGW-X86-64: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
31+
// MINGW-X86-64-NEXT:[[T1:%.*]] = getelementptr i8, ptr [[EXN]], i64 64
32+
// MINGW-ARMV7: [[T0:%.*]] = tail call arm_aapcs_vfpcc ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
33+
// MINGW-ARMV7-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 48
2834

2935
// X86-64: attributes [[NUW]] = { nounwind }
3036
// X86-32: attributes [[NUW]] = { nounwind }
3137
// ARM-DARWIN: attributes [[NUW]] = { nounwind }
3238
// ARM-EABI: attributes [[NUW]] = { nounwind }
3339
// MIPS: attributes [[NUW]] = { nounwind }
40+
// MINGW-X86-64: attributes [[NUW]] = { nounwind }
41+
// MINGW-ARMV7: attributes [[NUW]] = { nounwind }

0 commit comments

Comments
 (0)