[clang] [Liveness][analyzer] Fix liveness of binary logical operators and their subexpressions (PR #231419)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 05:25:42 PDT 2026


NagyDonat wrote:

> I wonder if this is unique to `BinaryOperator` or unaries also suffer from this?

Unaries are unaffected, this depends on the short-circuiting nature of the logical binary operators which makes their representation in the CFG a bit counter-intuitive.

> Next, are overloaded binary operators (some class' binary operators) affected? (I'm pretty sure they are not, because they are much more similar to function calls then to binops.)

They are not short-circuiting and they are represented by a different CFG node, so they are unaffected and should be unaffected.

> Finally, how about ternaries?

Ternary operators were already covered by a `case:` directly above the freshly added code. The new code follows the example of that logic and reuses the helper `AddAllConditionalTerms` which was originally introduced for that case.

A comment in that block claims that GNU binary conditional operators (`value ?: default` as a shortcut for `value ? value : default`) do not need this kind of special handling and this seems to be plausible.

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


More information about the cfe-commits mailing list