[PATCH] D158827: [clang] Fix assertion fail when function has cleanups and fatal errors
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 28 02:30:07 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ade434a7e74: [clang] Fix assertion fail when function has cleanups and fatal errors (authored by Fznamznon).
Changed prior to commit:
https://reviews.llvm.org/D158827?vs=553420&id=553872#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158827/new/
https://reviews.llvm.org/D158827
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCXX/gh48974.cpp
Index: clang/test/SemaCXX/gh48974.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/gh48974.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -Werror=unused-parameter -Wfatal-errors -verify %s
+
+void a(int &&s) {} // expected-error{{unused parameter 's'}}
+
+void b() {
+ int sum = a(0);
+}
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -16013,6 +16013,7 @@
// been leftover. This ensures that these temporaries won't be picked up
// for deletion in some later function.
if (hasUncompilableErrorOccurred() ||
+ hasAnyUnrecoverableErrorsInThisFunction() ||
getDiagnostics().getSuppressAllDiagnostics()) {
DiscardCleanupsInEvaluationContext();
}
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -187,6 +187,8 @@
- Fix crash in __builtin_strncmp and related builtins when the size value
exceeded the maximum value representable by int64_t. Fixes
(`#64876 <https://github.com/llvm/llvm-project/issues/64876>`_)
+- Fixed an assertion if a function has cleanups and fatal erors.
+ (`#48974 <https://github.com/llvm/llvm-project/issues/48974>`_)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158827.553872.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230828/1f94ac9f/attachment.bin>
More information about the cfe-commits
mailing list