[clang] [analyzer] Improve dangling value tracking in DanglingPtrDeref (PR #211818)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 07:47:57 PDT 2026
================
@@ -75,7 +75,9 @@ void DanglingPtrDeref::reportUseAfterScope(const MemRegion *Region,
" after its lifetime ended."),
N);
BR->addVisitor<DanglingPtrDerefBRVisitor>(Region);
- bugreporter::trackExpressionValue(N, bugreporter::getDerefExpr(S), *BR);
+ if (S)
+ if (const Expr *DerefExpr = bugreporter::getDerefExpr(S))
+ bugreporter::trackExpressionValue(N, DerefExpr, *BR);
----------------
steakhal wrote:
In this case I think I'd prefer a brace around the outer `if`.
https://github.com/llvm/llvm-project/pull/211818
More information about the cfe-commits
mailing list