[clang] [analyzer] Only report the first dereference of the same variable in DanglingPtrDeref (PR #215409)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 04:33:09 PDT 2026


================
@@ -86,6 +87,13 @@ bool lifetime_modeling::isDeallocated(ProgramStateRef State,
   return State->contains<DeallocatedSourceSet>(Region->getBaseRegion());
 }
 
+ProgramStateRef lifetime_modeling::markAsReported(ProgramStateRef State,
+                                                  const MemRegion *Region) {
+  if (State->contains<ReportedDeadRegions>(Region->getBaseRegion()))
+    return nullptr;
+  return State->add<ReportedDeadRegions>(Region->getBaseRegion());
----------------
benedekaibas wrote:

I see your point, thanks for highlighting it! I have made the changes: [a44befc](https://github.com/llvm/llvm-project/pull/215409/commits/a44befc77019d7a6fa68bd071a0a9e0deb05d70d) 

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


More information about the cfe-commits mailing list