================
@@ -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());
----------------
steakhal wrote:
This is the usual double lookup problem. This is my pet peeve.
`add` is idempotent (identity) if the thing you wanna put into was already
there. You could add unconditionally and check if the resulting state is
different. If so, the addition succeeded. If not, then return `nullptr`.
https://github.com/llvm/llvm-project/pull/215409
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits