aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorSamarth Narang <70980689+snarang181@users.noreply.github.com>2025-06-27 10:52:22 -0400
committerGitHub <noreply@github.com>2025-06-27 10:52:22 -0400
commit794edd187cee49e3f12cc2ce587d60fc85e08dd6 (patch)
tree857613bc850f25fe23a2a40be486f85a5fbc9f21 /clang/lib/Sema/Sema.cpp
parent07f1502b867e85b0b67a54664e57b71dcb37f1cb (diff)
downloadllvm-794edd187cee49e3f12cc2ce587d60fc85e08dd6.zip
llvm-794edd187cee49e3f12cc2ce587d60fc85e08dd6.tar.gz
llvm-794edd187cee49e3f12cc2ce587d60fc85e08dd6.tar.bz2
[clang] Suppress noreturn warning if last statement in a function is a throw (#145166)
Fixes https://github.com/llvm/llvm-project/issues/144952
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp5
1 files changed, 3 insertions, 2 deletions
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);