[Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas
authorDeniz Evrenci <denizevrenci@gmail.com>
Tue, 28 Feb 2023 10:36:46 +0000 (11:36 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 28 Feb 2023 10:41:07 +0000 (11:41 +0100)
commitf332498f9880d276890562fb861a375a13bfd9d9
treecb3ace526af4ee9873889397ab02171bc457d298
parentc34936465c5648f825414fe76ccad7a9ad82dddd
[Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas

All exceptions thrown in coroutine bodies are caught and
unhandled_exception member of the coroutine promise type is called.
In accordance with the existing rules of diagnostics related to
exceptions thrown in functions marked noexcept, even if the promise
type's constructor, get_return_object, or unhandled_exception
throws, diagnostics should not be emitted.

Fixes #48797.

Differential Revision: https://reviews.llvm.org/D144352
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp [new file with mode: 0644]