[all-commits] [llvm/llvm-project] 41c566: [Clang] eliminate -Winvalid-noreturn false positiv...
Oleksandr Tarasiuk via All-commits
all-commits at lists.llvm.org
Fri Feb 13 10:25:31 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 41c566e9e16489d599a9cf45e32a02aace925785
https://github.com/llvm/llvm-project/commit/41c566e9e16489d599a9cf45e32a02aace925785
Author: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: 2026-02-13 (Fri, 13 Feb 2026)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Analysis/CFG.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
M clang/test/Analysis/misc-ps-region-store.cpp
M clang/test/SemaCXX/return-noreturn.cpp
Log Message:
-----------
[Clang] eliminate -Winvalid-noreturn false positive after throw + unreachable try/catch blocks (#175443)
Fixes #174822
---
This PR fixes a false `-Winvalid-noreturn` positive when an
unconditional `throw` is followed by an unreachable `try`/`catch` block.
The false positive occurred because reachability analysis marked
`try`/`catch` regions as live even when unreachable via normal control
flow. The following logic
https://github.com/llvm/llvm-project/blob/1c0c9aeae681dbed90fcb19edd8a41e10a17f867/clang/lib/Sema/AnalysisBasedWarnings.cpp#L573-L589
that adjusted for missing `EH` call edges, treated disconnected `try` as
reachable.
CFG construction now keeps the `try` dispatch block as the join point of
the `try` statement and adds a successor for the `try` body. If the
`try` body is empty, an empty block is created and connected to the
successor. This prevents the `try` dispatch from becoming disconnected
and ensures that return paths in _function-try-blocks_
https://github.com/llvm/llvm-project/blob/1c0c9aeae681dbed90fcb19edd8a41e10a17f867/clang/test/SemaCXX/return-noreturn.cpp#L249-L264
Also, unreachable try/catch code after an unconditional `throw` is no
longer treated as reachable and no longer triggers a false positive
`-Winvalid-noreturn` warning.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list