[clang] [LifetimeSafety] Fix crash on ternary operator when one of the expressions is `throw` (PR #190345)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 08:46:02 PDT 2026
================
@@ -400,12 +401,58 @@ void FactsGenerator::VisitBinaryOperator(const BinaryOperator *BO) {
// TODO: Handle assignments involving dereference like `*p = q`.
}
+void FactsGenerator::handleTernaryOperator(const ConditionalOperator *CO) {
+ const Expr *TrueExpr = CO->getTrueExpr();
+ const Expr *FalseExpr = CO->getFalseExpr();
+
+ const auto Preds = CurrentBlock->preds();
+ auto PredHasStmt = [](const CFGBlock::AdjacentBlock &Pred, const Stmt *S) {
+ return llvm::any_of(*Pred, [S](const CFGElement &Elt) {
+ if (auto CS = Elt.getAs<CFGStmt>()) {
+ return CS->getStmt() == S;
+ }
----------------
usx95 wrote:
nit: avoid braces for single line `if` block
https://github.com/llvm/llvm-project/pull/190345
More information about the cfe-commits
mailing list