================ @@ -217,34 +231,72 @@ void matchDereferenceExpr(const Stmt *stmt, Env.assume(Env.arena().makeNot(getVal(kIsNull, *RootValue).formula())); } -void matchCastExpr(const CastExpr *cond, const MatchFinder::MatchResult &Result, - NullPointerAnalysisModel::TransferArgs &Data) { - auto [IsNonnullBranch, Env] = Data; - +void matchNullCheckExpr(const Expr *NullCheck, + const MatchFinder::MatchResult &Result, + Environment &Env) { const auto *Var = Result.Nodes.getNodeAs<Expr>(kVar); assert(Var != nullptr); - Value *RootValue = getValue(*Var, Env); - - Value *NewRootValue = Env.createValue(Var->getType()); + // (bool)p or (p != nullptr) + bool IsNonnullOp = true; + if (auto *BinOp = dyn_cast<BinaryOperator>(NullCheck); ---------------- EugeneZelenko wrote:
` ```suggestion if (const auto *BinOp = dyn_cast<BinaryOperator>(NullCheck); ``` https://github.com/llvm/llvm-project/pull/84166 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits