[clang] [analyzer][NFC] Use a base region map in RemoveDeadBindingsWorker (PR #246433)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 12:12:53 PST 2026
================
@@ -3026,59 +3036,106 @@ RegionStoreManager::bindAggregate(LimitedRegionBindingsConstRef B,
//===----------------------------------------------------------------------===//
namespace {
-class RemoveDeadBindingsWorker
- : public ClusterAnalysis<RemoveDeadBindingsWorker> {
+class RemoveDeadBindingsWorker {
+ using ClusterInfo = DeadBindingsClusterInfo;
+
+ RegionStoreManager &RM;
+ RegionBindingsRef B;
SmallVector<const SymbolicRegion *, 12> Postponed;
SymbolReaper &SymReaper;
const StackFrame *CurrentSF;
-public:
- RemoveDeadBindingsWorker(RegionStoreManager &rm,
- ProgramStateManager &stateMgr, RegionBindingsRef b,
- SymbolReaper &symReaper, const StackFrame *SF)
- : ClusterAnalysis<RemoveDeadBindingsWorker>(rm, stateMgr, b),
- SymReaper(symReaper), CurrentSF(SF) {}
-
- // Called by ClusterAnalysis.
- void VisitAddedToCluster(const MemRegion *baseR, const ClusterBindings &C);
- void VisitCluster(const MemRegion *baseR, const ClusterBindings *C);
- using ClusterAnalysis<RemoveDeadBindingsWorker>::VisitCluster;
+ // Every cluster of the store by its base region, and whether it is live.
+ DeadBindingsClusterMapTy &Clusters;
+ SmallVector<std::pair<const MemRegion *, const ClusterBindings *>, 32>
+ ClusterWL;
+ unsigned NumVisited = 0;
- using ClusterAnalysis::AddToWorkList;
+ bool AddToWorkList(const MemRegion *BaseR, ClusterInfo &Info);
+ void VisitAddedToCluster(const MemRegion *baseR, ClusterInfo &Info);
+ void VisitCluster(const MemRegion *baseR, const ClusterBindings &C);
----------------
NagyDonat wrote:
Please capitalize `baseR` at least in these declarations to be consistent with the declaration above them. Personally I'd also capitalize it in the definitions (that would touch +7 lines), but feel free to skip that if you prefer.
https://github.com/llvm/llvm-project/pull/246433
More information about the cfe-commits
mailing list