================
@@ -3910,8 +3910,13 @@ StmtResult Sema::BuildReturnStmt(SourceLocation
ReturnLoc, Expr *RetValExp,
FnRetType = FD->getReturnType();
if (FD->hasAttrs())
Attrs = &FD->getAttrs();
- if (FD->isNoReturn())
- Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD;
+ if (FD->isNoReturn()) {
+ const FunctionScopeInfo *Scope = getEnclosingFunction();
+ if (Scope && Scope->isCoroutine())
+ Diag(ReturnLoc, diag::warn_noreturn_coroutine) << FD;
+ else
+ Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD;
+ }
----------------
Sirraide wrote:
> The diagnostic for noreturn functions was there before (i.e. your suggested
> change would remove it)
It’s supposed to remove it iff the enclosing function is a coroutine. We should
still emit noreturn warnings for regular functions.
https://github.com/llvm/llvm-project/pull/127623
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits