@@ -714,9 +714,6 @@ class RegionStoreManager : public StoreManager {
714714 return getBinding (getRegionBindings (S), L, T);
715715 }
716716
717- std::optional<SVal>
718- getUniqueDefaultBinding (nonloc::LazyCompoundVal LCV) const ;
719-
720717 std::optional<SVal> getDefaultBinding (Store S, const MemRegion *R) override {
721718 RegionBindingsRef B = getRegionBindings (S);
722719 // Default bindings are always applied over a base region so look up the
@@ -2750,46 +2747,12 @@ RegionStoreManager::bindVector(LimitedRegionBindingsConstRef B,
27502747 return NewB;
27512748}
27522749
2753- std::optional<SVal>
2754- RegionStoreManager::getUniqueDefaultBinding (nonloc::LazyCompoundVal LCV) const {
2755- const MemRegion *BaseR = LCV.getRegion ();
2756-
2757- // We only handle base regions.
2758- if (BaseR != BaseR->getBaseRegion ())
2759- return std::nullopt ;
2760-
2761- const auto *Cluster = getRegionBindings (LCV.getStore ()).lookup (BaseR);
2762- if (!Cluster || !llvm::hasSingleElement (*Cluster))
2763- return std::nullopt ;
2764-
2765- const auto [Key, Value] = *Cluster->begin ();
2766- return Key.isDirect () ? std::optional<SVal>{} : Value;
2767- }
2768-
27692750std::optional<LimitedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct (
27702751 LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
27712752 const RecordDecl *RD, nonloc::LazyCompoundVal LCV) {
27722753 if (B.hasExhaustedBindingLimit ())
27732754 return B.withValuesEscaped (LCV);
27742755
2775- // If we try to copy a Conjured value representing the value of the whole
2776- // struct, don't try to element-wise copy each field.
2777- // That would unnecessarily bind Derived symbols slicing off the subregion for
2778- // the field from the whole Conjured symbol.
2779- //
2780- // struct Window { int width; int height; };
2781- // Window getWindow(); <-- opaque fn.
2782- // Window w = getWindow(); <-- conjures a new Window.
2783- // Window w2 = w; <-- trivial copy "w", calling "tryBindSmallStruct"
2784- //
2785- // We should not end up with a new Store for "w2" like this:
2786- // Direct [ 0..31]: Derived{Conj{}, w.width}
2787- // Direct [32..63]: Derived{Conj{}, w.height}
2788- // Instead, we should just bind that Conjured value instead.
2789- if (std::optional<SVal> Val = getUniqueDefaultBinding (LCV)) {
2790- return B.addBinding (BindingKey::Make (R, BindingKey::Default), Val.value ());
2791- }
2792-
27932756 FieldVector Fields;
27942757
27952758 if (const CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(RD))
0 commit comments