[clang] [analyzer] Improve dangling value tracking in DanglingPtrDeref (PR #211818)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 07:54:34 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);
----------------
benedekaibas wrote:

Yes, I agree, that it is needed. Added here: [61322cc](https://github.com/llvm/llvm-project/pull/211818/commits/61322cc7594be0903821ecffb3a84334a0cf0435)

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


More information about the cfe-commits mailing list