From 794edd187cee49e3f12cc2ce587d60fc85e08dd6 Mon Sep 17 00:00:00 2001 From: Samarth Narang <70980689+snarang181@users.noreply.github.com> Date: Fri, 27 Jun 2025 10:52:22 -0400 Subject: [clang] Suppress noreturn warning if last statement in a function is a throw (#145166) Fixes https://github.com/llvm/llvm-project/issues/144952 --- clang/lib/Sema/Sema.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/Sema.cpp') diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 42ebf2a..dfc5a27 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -2434,9 +2434,10 @@ Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP, OpenMP().popOpenMPFunctionRegion(Scope.get()); // Issue any analysis-based warnings. - if (WP && D) + if (WP && D) { + inferNoReturnAttr(*this, D); AnalysisWarnings.IssueWarnings(*WP, Scope.get(), D, BlockType); - else + } else for (const auto &PUD : Scope->PossiblyUnreachableDiags) Diag(PUD.Loc, PUD.PD); -- cgit v1.1