================ @@ -176,31 +177,59 @@ class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *, // however that would have made the manager needlessly stateful. bool IsMainAnalysis; + unsigned BindingsLeft; + public: + unsigned bindingsLeft() const { return BindingsLeft; } + + bool hasExhaustedBindingLimit() const { return BindingsLeft == 0; } + + RegionBindingsRef escapeValue(SVal V) const { + assert(EscapedValuesDuringBind); + EscapedValuesDuringBind->push_back(V); + return *this; + } + RegionBindingsRef escapeValues(nonloc::CompoundVal::iterator Begin, + nonloc::CompoundVal::iterator End) const { + for (SVal V : llvm::make_range(Begin, End)) + escapeValue(V); + return *this; + } + typedef llvm::ImmutableMapRef<const MemRegion *, ClusterBindings> ParentTy; RegionBindingsRef(ClusterBindings::Factory &CBFactory, + SmallVectorImpl<SVal> *EscapedValuesDuringBind, const RegionBindings::TreeTy *T, - RegionBindings::TreeTy::Factory *F, - bool IsMainAnalysis) - : llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(T, F), - CBFactory(&CBFactory), IsMainAnalysis(IsMainAnalysis) {} - - RegionBindingsRef(const ParentTy &P, - ClusterBindings::Factory &CBFactory, - bool IsMainAnalysis) - : llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(P), - CBFactory(&CBFactory), IsMainAnalysis(IsMainAnalysis) {} + RegionBindings::TreeTy::Factory *F, bool IsMainAnalysis, + unsigned BindingsLeft) + : RegionBindingsRef(ParentTy(T, F), CBFactory, EscapedValuesDuringBind, + IsMainAnalysis, BindingsLeft) {} + + RegionBindingsRef(const ParentTy &P, ClusterBindings::Factory &CBFactory, + SmallVectorImpl<SVal> *EscapedValuesDuringBind, + bool IsMainAnalysis, unsigned BindingsLeft) + : ParentTy(P), CBFactory(&CBFactory), + EscapedValuesDuringBind(EscapedValuesDuringBind), + IsMainAnalysis(IsMainAnalysis), BindingsLeft(BindingsLeft) {} + + RegionBindingsRef add(key_type_ref K, data_type_ref D, ---------------- NagyDonat wrote:
Thanks for resolving this confusion by renaming `add` to `commitBindingsToCluster` -- with this new name I finally understand what does this function do. (While it seems that even "reading them at least four times" wasn't enough for me to get an accurate picture...) https://github.com/llvm/llvm-project/pull/127602 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits