[clang] [LifetimeSafety] Fix crash on ternary operator when one of the expressions is `throw` (PR #190345)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 4 02:19:55 PDT 2026
NeKon69 wrote:
Hey! I was trying to implement this, but it doesn't seem like the CFG knows that one of the branches does not continue control flow from there
Here's a CFG dump of your example (plus some extra stuff from my side):
```
[B4]
1: cond
2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)
T: [B4.2] ? ... : ...
Preds (1): B5
Succs (2): B2 B3
True expression reachable: 1
False expression reachable: 1
```
However, on something simpler it works as expected, such as `int *p = true ? q1 : q2;`. So I'm wondering if I need to modify the CFG logic to check whether the branch expression is a call to a `[[noreturn]]` function, or maybe you want something more general?
https://github.com/llvm/llvm-project/pull/190345
More information about the cfe-commits
mailing list