@@ -2570,6 +2570,9 @@ RegionStoreManager::bind(LimitedRegionBindingsConstRef B, Loc L, SVal V) {
2570
2570
LimitedRegionBindingsRef
2571
2571
RegionStoreManager::setImplicitDefaultValue (LimitedRegionBindingsConstRef B,
2572
2572
const MemRegion *R, QualType T) {
2573
+ if (B.hasExhaustedBindingLimit ())
2574
+ return B;
2575
+
2573
2576
SVal V;
2574
2577
2575
2578
if (Loc::isLocType (T))
@@ -2596,6 +2599,8 @@ RegionStoreManager::setImplicitDefaultValue(LimitedRegionBindingsConstRef B,
2596
2599
std::optional<LimitedRegionBindingsRef> RegionStoreManager::tryBindSmallArray (
2597
2600
LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
2598
2601
const ArrayType *AT, nonloc::LazyCompoundVal LCV) {
2602
+ if (B.hasExhaustedBindingLimit ())
2603
+ return B.withValuesEscaped (LCV);
2599
2604
2600
2605
auto CAT = dyn_cast<ConstantArrayType>(AT);
2601
2606
@@ -2632,6 +2637,8 @@ RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B,
2632
2637
const TypedValueRegion *R, SVal Init) {
2633
2638
llvm::TimeTraceScope TimeScope (" RegionStoreManager::bindArray" ,
2634
2639
[R]() { return R->getDescriptiveName (); });
2640
+ if (B.hasExhaustedBindingLimit ())
2641
+ return B.withValuesEscaped (Init);
2635
2642
2636
2643
const ArrayType *AT =cast<ArrayType>(Ctx.getCanonicalType (R->getValueType ()));
2637
2644
QualType ElementTy = AT->getElementType ();
@@ -2698,6 +2705,9 @@ RegionStoreManager::bindVector(LimitedRegionBindingsConstRef B,
2698
2705
const TypedValueRegion *R, SVal V) {
2699
2706
llvm::TimeTraceScope TimeScope (" RegionStoreManager::bindVector" ,
2700
2707
[R]() { return R->getDescriptiveName (); });
2708
+ if (B.hasExhaustedBindingLimit ())
2709
+ return B.withValuesEscaped (V);
2710
+
2701
2711
QualType T = R->getValueType ();
2702
2712
const VectorType *VT = T->castAs <VectorType>(); // Use castAs for typedefs.
2703
2713
@@ -2722,6 +2732,9 @@ RegionStoreManager::bindVector(LimitedRegionBindingsConstRef B,
2722
2732
if (VI == VE)
2723
2733
break ;
2724
2734
2735
+ if (NewB.hasExhaustedBindingLimit ())
2736
+ return NewB.withValuesEscaped (VI, VE);
2737
+
2725
2738
NonLoc Idx = svalBuilder.makeArrayIndex (index);
2726
2739
const ElementRegion *ER = MRMgr.getElementRegion (ElemType, Idx, R, Ctx);
2727
2740
@@ -2758,6 +2771,9 @@ RegionStoreManager::getUniqueDefaultBinding(nonloc::LazyCompoundVal LCV) const {
2758
2771
std::optional<LimitedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct (
2759
2772
LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
2760
2773
const RecordDecl *RD, nonloc::LazyCompoundVal LCV) {
2774
+ if (B.hasExhaustedBindingLimit ())
2775
+ return B.withValuesEscaped (LCV);
2776
+
2761
2777
// If we try to copy a Conjured value representing the value of the whole
2762
2778
// struct, don't try to element-wise copy each field.
2763
2779
// That would unnecessarily bind Derived symbols slicing off the subregion for
@@ -2822,6 +2838,9 @@ RegionStoreManager::bindStruct(LimitedRegionBindingsConstRef B,
2822
2838
const TypedValueRegion *R, SVal V) {
2823
2839
llvm::TimeTraceScope TimeScope (" RegionStoreManager::bindStruct" ,
2824
2840
[R]() { return R->getDescriptiveName (); });
2841
+ if (B.hasExhaustedBindingLimit ())
2842
+ return B.withValuesEscaped (V);
2843
+
2825
2844
QualType T = R->getValueType ();
2826
2845
assert (T->isStructureOrClassType ());
2827
2846
@@ -2931,6 +2950,9 @@ RegionStoreManager::bindStruct(LimitedRegionBindingsConstRef B,
2931
2950
++VI;
2932
2951
}
2933
2952
2953
+ if (NewB.hasExhaustedBindingLimit ())
2954
+ return NewB.withValuesEscaped (VI, VE);
2955
+
2934
2956
// There may be fewer values in the initialize list than the fields of struct.
2935
2957
if (FI != FE) {
2936
2958
NewB = NewB.addBinding (R, BindingKey::Default,
@@ -2945,6 +2967,9 @@ RegionStoreManager::bindAggregate(LimitedRegionBindingsConstRef B,
2945
2967
const TypedRegion *R, SVal Val) {
2946
2968
llvm::TimeTraceScope TimeScope (" RegionStoreManager::bindAggregate" ,
2947
2969
[R]() { return R->getDescriptiveName (); });
2970
+ if (B.hasExhaustedBindingLimit ())
2971
+ return B.withValuesEscaped (Val);
2972
+
2948
2973
// Remove the old bindings, using 'R' as the root of all regions
2949
2974
// we will invalidate. Then add the new binding.
2950
2975
return removeSubRegionBindings (B, R).addBinding (R, BindingKey::Default, Val);
0 commit comments