[PATCH] D151393: [CodeGen] Make __clang_call_terminate have an unwind table entry
Shoaib Meenai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 25 10:57:51 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f7b51e4ec09: [CodeGen] Make __clang_call_terminate have an unwind table entry (authored by smeenai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151393/new/
https://reviews.llvm.org/D151393
Files:
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGenCXX/clang-call-terminate.uwtable.cpp
Index: clang/test/CodeGenCXX/clang-call-terminate.uwtable.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/clang-call-terminate.uwtable.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefixes=CHECK,NOUNWIND %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -fexceptions -fcxx-exceptions -funwind-tables=1 -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefixes=CHECK,SYNCUNWIND %s
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -fexceptions -fcxx-exceptions -funwind-tables=2 -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefixes=CHECK,ASYNCUNWIND %s
+
+void caller(void callback()) noexcept { callback(); }
+
+// CHECK: define {{.*}}void @__clang_call_terminate({{[^)]*}}) #[[#ATTRNUM:]]
+// CHECK: attributes #[[#ATTRNUM]] = {
+// NOUNWIND-NOT: uwtable
+// NOUNWIND-SAME: }
+// SYNCUNWIND-SAME: uwtable(sync)
+// ASYNCUNWIND-SAME: uwtable{{ }}
Index: clang/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -4689,6 +4689,7 @@
cast<llvm::Function>(fnRef.getCallee()->stripPointerCasts());
if (fn->empty()) {
CGM.SetLLVMFunctionAttributes(GlobalDecl(), FI, fn, /*IsThunk=*/false);
+ CGM.SetLLVMFunctionAttributesForDefinition(nullptr, fn);
fn->setDoesNotThrow();
fn->setDoesNotReturn();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151393.525703.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230525/8961c9d0/attachment.bin>
More information about the cfe-commits
mailing list