Fznamznon created this revision.
Herald added a project: All.
Fznamznon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fixes https://github.com/llvm/llvm-project/issues/48974
Repository:
rG LLVM Github Monorepo
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
@@ -172,6 +172,8 @@
- Clang now prints unnamed members in diagnostic messages instead of giving an
empty ''. Fixes
(`#63759 <https://github.com/llvm/llvm-project/issues/63759>`_)
+- 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
@@ -172,6 +172,8 @@
- Clang now prints unnamed members in diagnostic messages instead of giving an
empty ''. Fixes
(`#63759 <https://github.com/llvm/llvm-project/issues/63759>`_)
+- 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits