[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
Sun Apr 5 03:24:33 PDT 2026


NeKon69 wrote:

Hmmm it looks like that for `throw` it still doesn't mark it as `noreturn`. I dug a bit deeper and found this function

https://github.com/llvm/llvm-project/blob/df2de0a26d187d42f55f2d340309c552b1bb0186/clang/lib/Analysis/CFG.cpp#L4308-L4314

Which as you see calls normal `createBlock`, not `createNoReturnBlock`.

So I'm wondering if something like this is fine?

```cpp
  bool TBNoReturn = Map->getBlock(TrueExpr)->hasNoReturnElement() ||
                       !producesConditionalResult(TrueExpr);
  bool FBNoReturn = Map->getBlock(FalseExpr)->hasNoReturnElement() ||
                       !producesConditionalResult(FalseExpr);
```

https://github.com/llvm/llvm-project/pull/190345


More information about the cfe-commits mailing list