Skip to content

Commit 83131d8

Browse files
Rename to LimitedRegionBindingsRef
1 parent 3d1d1b2 commit 83131d8

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

clang/lib/StaticAnalyzer/Core/RegionStore.cpp

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
329329

330330
/// This class represents the same as \c RegionBindingsRef, but with a limit on
331331
/// the number of bindings that can be added.
332-
class BoundedRegionBindingsRef : public RegionBindingsRef {
332+
class LimitedRegionBindingsRef : public RegionBindingsRef {
333333
public:
334-
BoundedRegionBindingsRef(RegionBindingsRef Base,
334+
LimitedRegionBindingsRef(RegionBindingsRef Base,
335335
SmallVectorImpl<SVal> &EscapedValuesDuringBind,
336336
std::optional<unsigned> BindingsLeft)
337337
: RegionBindingsRef(Base),
@@ -342,34 +342,34 @@ class BoundedRegionBindingsRef : public RegionBindingsRef {
342342
return BindingsLeft.has_value() && BindingsLeft.value() == 0;
343343
}
344344

345-
BoundedRegionBindingsRef withValuesEscaped(SVal V) const {
345+
LimitedRegionBindingsRef withValuesEscaped(SVal V) const {
346346
EscapedValuesDuringBind->push_back(V);
347347
return *this;
348348
}
349349

350-
BoundedRegionBindingsRef
350+
LimitedRegionBindingsRef
351351
withValuesEscaped(nonloc::CompoundVal::iterator Begin,
352352
nonloc::CompoundVal::iterator End) const {
353353
for (SVal V : llvm::make_range(Begin, End))
354354
withValuesEscaped(V);
355355
return *this;
356356
}
357357

358-
BoundedRegionBindingsRef
358+
LimitedRegionBindingsRef
359359
addWithoutDecreasingLimit(const MemRegion *BaseRegion,
360360
data_type_ref BindingKeyAndValue) const {
361-
return BoundedRegionBindingsRef{RegionBindingsRef::commitBindingsToCluster(
361+
return LimitedRegionBindingsRef{RegionBindingsRef::commitBindingsToCluster(
362362
BaseRegion, BindingKeyAndValue),
363363
*EscapedValuesDuringBind, BindingsLeft};
364364
}
365365

366-
BoundedRegionBindingsRef removeCluster(const MemRegion *BaseRegion) const {
367-
return BoundedRegionBindingsRef{
366+
LimitedRegionBindingsRef removeCluster(const MemRegion *BaseRegion) const {
367+
return LimitedRegionBindingsRef{
368368
RegionBindingsRef::removeCluster(BaseRegion), *EscapedValuesDuringBind,
369369
BindingsLeft};
370370
}
371371

372-
BoundedRegionBindingsRef addBinding(BindingKey K, SVal V) const {
372+
LimitedRegionBindingsRef addBinding(BindingKey K, SVal V) const {
373373
std::optional<unsigned> NewBindingsLeft = BindingsLeft;
374374
if (NewBindingsLeft.has_value()) {
375375
assert(NewBindingsLeft.value() != 0);
@@ -384,11 +384,11 @@ class BoundedRegionBindingsRef : public RegionBindingsRef {
384384
}
385385
}
386386

387-
return BoundedRegionBindingsRef{RegionBindingsRef::addBinding(K, V),
387+
return LimitedRegionBindingsRef{RegionBindingsRef::addBinding(K, V),
388388
*EscapedValuesDuringBind, NewBindingsLeft};
389389
}
390390

391-
BoundedRegionBindingsRef addBinding(const MemRegion *R, BindingKey::Kind k,
391+
LimitedRegionBindingsRef addBinding(const MemRegion *R, BindingKey::Kind k,
392392
SVal V) const {
393393
return addBinding(BindingKey::Make(R, k), V);
394394
}
@@ -399,7 +399,7 @@ class BoundedRegionBindingsRef : public RegionBindingsRef {
399399
};
400400

401401
typedef const RegionBindingsRef& RegionBindingsConstRef;
402-
typedef const BoundedRegionBindingsRef &BoundedRegionBindingsConstRef;
402+
typedef const LimitedRegionBindingsRef &LimitedRegionBindingsConstRef;
403403

404404
std::optional<SVal>
405405
RegionBindingsRef::getDirectBinding(const MemRegion *R) const {
@@ -535,8 +535,8 @@ class RegionStoreManager : public StoreManager {
535535
/// setImplicitDefaultValue - Set the default binding for the provided
536536
/// MemRegion to the value implicitly defined for compound literals when
537537
/// the value is not specified.
538-
BoundedRegionBindingsRef
539-
setImplicitDefaultValue(BoundedRegionBindingsConstRef B, const MemRegion *R,
538+
LimitedRegionBindingsRef
539+
setImplicitDefaultValue(LimitedRegionBindingsConstRef B, const MemRegion *R,
540540
QualType T);
541541

542542
/// ArrayToPointer - Emulates the "decay" of an array to a pointer
@@ -579,8 +579,8 @@ class RegionStoreManager : public StoreManager {
579579
bool scanReachableSymbols(Store S, const MemRegion *R,
580580
ScanReachableSymbols &Callbacks) override;
581581

582-
BoundedRegionBindingsRef
583-
removeSubRegionBindings(BoundedRegionBindingsConstRef B, const SubRegion *R);
582+
LimitedRegionBindingsRef
583+
removeSubRegionBindings(LimitedRegionBindingsConstRef B, const SubRegion *R);
584584
std::optional<SVal>
585585
getConstantValFromConstArrayInitializer(RegionBindingsConstRef B,
586586
const ElementRegion *R);
@@ -594,13 +594,13 @@ class RegionStoreManager : public StoreManager {
594594
public: // Part of public interface to class.
595595
BindResult Bind(Store store, Loc LV, SVal V) override {
596596
llvm::SmallVector<SVal, 0> EscapedValuesDuringBind;
597-
BoundedRegionBindingsRef BoundedBindings =
597+
LimitedRegionBindingsRef BoundedBindings =
598598
getRegionBindings(store, EscapedValuesDuringBind);
599599
return BindResult{StoreRef(bind(BoundedBindings, LV, V).asStore(), *this),
600600
std::move(EscapedValuesDuringBind)};
601601
}
602602

603-
BoundedRegionBindingsRef bind(BoundedRegionBindingsConstRef B, Loc LV,
603+
LimitedRegionBindingsRef bind(LimitedRegionBindingsConstRef B, Loc LV,
604604
SVal V);
605605

606606
// BindDefaultInitial is only used to initialize a region with
@@ -634,7 +634,7 @@ class RegionStoreManager : public StoreManager {
634634
return BindResult{StoreRef(store, *this), {}};
635635

636636
llvm::SmallVector<SVal, 0> EscapedValuesDuringBind;
637-
BoundedRegionBindingsRef B =
637+
LimitedRegionBindingsRef B =
638638
getRegionBindings(store, EscapedValuesDuringBind);
639639
SVal V = svalBuilder.makeZeroVal(Ctx.CharTy);
640640
B = removeSubRegionBindings(B, cast<SubRegion>(R));
@@ -654,28 +654,28 @@ class RegionStoreManager : public StoreManager {
654654
///
655655
/// \returns The updated store bindings, or \c std::nullopt if binding
656656
/// non-lazily would be too expensive.
657-
std::optional<BoundedRegionBindingsRef>
658-
tryBindSmallStruct(BoundedRegionBindingsConstRef B, const TypedValueRegion *R,
657+
std::optional<LimitedRegionBindingsRef>
658+
tryBindSmallStruct(LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
659659
const RecordDecl *RD, nonloc::LazyCompoundVal LCV);
660660

661661
/// BindStruct - Bind a compound value to a structure.
662-
BoundedRegionBindingsRef bindStruct(BoundedRegionBindingsConstRef B,
662+
LimitedRegionBindingsRef bindStruct(LimitedRegionBindingsConstRef B,
663663
const TypedValueRegion *R, SVal V);
664664

665665
/// BindVector - Bind a compound value to a vector.
666-
BoundedRegionBindingsRef bindVector(BoundedRegionBindingsConstRef B,
666+
LimitedRegionBindingsRef bindVector(LimitedRegionBindingsConstRef B,
667667
const TypedValueRegion *R, SVal V);
668668

669-
std::optional<BoundedRegionBindingsRef>
670-
tryBindSmallArray(BoundedRegionBindingsConstRef B, const TypedValueRegion *R,
669+
std::optional<LimitedRegionBindingsRef>
670+
tryBindSmallArray(LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
671671
const ArrayType *AT, nonloc::LazyCompoundVal LCV);
672672

673-
BoundedRegionBindingsRef bindArray(BoundedRegionBindingsConstRef B,
673+
LimitedRegionBindingsRef bindArray(LimitedRegionBindingsConstRef B,
674674
const TypedValueRegion *R, SVal V);
675675

676676
/// Clears out all bindings in the given region and assigns a new value
677677
/// as a Default binding.
678-
BoundedRegionBindingsRef bindAggregate(BoundedRegionBindingsConstRef B,
678+
LimitedRegionBindingsRef bindAggregate(LimitedRegionBindingsConstRef B,
679679
const TypedRegion *R, SVal DefaultVal);
680680

681681
/// Create a new store with the specified binding removed.
@@ -805,10 +805,10 @@ class RegionStoreManager : public StoreManager {
805805
RBFactory.getTreeFactory(), Ptr.getInt()};
806806
}
807807

808-
BoundedRegionBindingsRef
808+
LimitedRegionBindingsRef
809809
getRegionBindings(Store store,
810810
SmallVectorImpl<SVal> &EscapedValuesDuringBind) const {
811-
return BoundedRegionBindingsRef(
811+
return LimitedRegionBindingsRef(
812812
getRegionBindings(store), EscapedValuesDuringBind,
813813
/*BindingsLeft=*/RegionStoreMaxBindingFanOutPlusOne);
814814
}
@@ -1099,8 +1099,8 @@ collectSubRegionBindings(SmallVectorImpl<BindingPair> &Bindings,
10991099
IncludeAllDefaultBindings);
11001100
}
11011101

1102-
BoundedRegionBindingsRef
1103-
RegionStoreManager::removeSubRegionBindings(BoundedRegionBindingsConstRef B,
1102+
LimitedRegionBindingsRef
1103+
RegionStoreManager::removeSubRegionBindings(LimitedRegionBindingsConstRef B,
11041104
const SubRegion *Top) {
11051105
BindingKey TopKey = BindingKey::Make(Top, BindingKey::Default);
11061106
const MemRegion *ClusterHead = TopKey.getBaseRegion();
@@ -2518,8 +2518,8 @@ StoreRef RegionStoreManager::killBinding(Store ST, Loc L) {
25182518
return StoreRef(ST, *this);
25192519
}
25202520

2521-
BoundedRegionBindingsRef
2522-
RegionStoreManager::bind(BoundedRegionBindingsConstRef B, Loc L, SVal V) {
2521+
LimitedRegionBindingsRef
2522+
RegionStoreManager::bind(LimitedRegionBindingsConstRef B, Loc L, SVal V) {
25232523
llvm::TimeTraceScope TimeScope("RegionStoreManager::bind",
25242524
[&L]() { return locDescr(L); });
25252525

@@ -2567,8 +2567,8 @@ RegionStoreManager::bind(BoundedRegionBindingsConstRef B, Loc L, SVal V) {
25672567
return NewB.addBinding(BindingKey::Make(R, KeyKind), V);
25682568
}
25692569

2570-
BoundedRegionBindingsRef
2571-
RegionStoreManager::setImplicitDefaultValue(BoundedRegionBindingsConstRef B,
2570+
LimitedRegionBindingsRef
2571+
RegionStoreManager::setImplicitDefaultValue(LimitedRegionBindingsConstRef B,
25722572
const MemRegion *R, QualType T) {
25732573
SVal V;
25742574

@@ -2593,8 +2593,8 @@ RegionStoreManager::setImplicitDefaultValue(BoundedRegionBindingsConstRef B,
25932593
return B.addBinding(R, BindingKey::Default, V);
25942594
}
25952595

2596-
std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallArray(
2597-
BoundedRegionBindingsConstRef B, const TypedValueRegion *R,
2596+
std::optional<LimitedRegionBindingsRef> RegionStoreManager::tryBindSmallArray(
2597+
LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
25982598
const ArrayType *AT, nonloc::LazyCompoundVal LCV) {
25992599

26002600
auto CAT = dyn_cast<ConstantArrayType>(AT);
@@ -2612,7 +2612,7 @@ std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallArray(
26122612
if (ArrSize > SmallArrayLimit)
26132613
return std::nullopt;
26142614

2615-
BoundedRegionBindingsRef NewB = B;
2615+
LimitedRegionBindingsRef NewB = B;
26162616

26172617
for (uint64_t i = 0; i < ArrSize; ++i) {
26182618
auto Idx = svalBuilder.makeArrayIndex(i);
@@ -2627,8 +2627,8 @@ std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallArray(
26272627
return NewB;
26282628
}
26292629

2630-
BoundedRegionBindingsRef
2631-
RegionStoreManager::bindArray(BoundedRegionBindingsConstRef B,
2630+
LimitedRegionBindingsRef
2631+
RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B,
26322632
const TypedValueRegion *R, SVal Init) {
26332633
llvm::TimeTraceScope TimeScope("RegionStoreManager::bindArray",
26342634
[R]() { return R->getDescriptiveName(); });
@@ -2664,7 +2664,7 @@ RegionStoreManager::bindArray(BoundedRegionBindingsConstRef B,
26642664
nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end();
26652665
uint64_t i = 0;
26662666

2667-
BoundedRegionBindingsRef NewB = B;
2667+
LimitedRegionBindingsRef NewB = B;
26682668

26692669
for (; Size ? i < *Size : true; ++i, ++VI) {
26702670
// The init list might be shorter than the array length.
@@ -2693,8 +2693,8 @@ RegionStoreManager::bindArray(BoundedRegionBindingsConstRef B,
26932693
return NewB;
26942694
}
26952695

2696-
BoundedRegionBindingsRef
2697-
RegionStoreManager::bindVector(BoundedRegionBindingsConstRef B,
2696+
LimitedRegionBindingsRef
2697+
RegionStoreManager::bindVector(LimitedRegionBindingsConstRef B,
26982698
const TypedValueRegion *R, SVal V) {
26992699
llvm::TimeTraceScope TimeScope("RegionStoreManager::bindVector",
27002700
[R]() { return R->getDescriptiveName(); });
@@ -2716,7 +2716,7 @@ RegionStoreManager::bindVector(BoundedRegionBindingsConstRef B,
27162716
nonloc::CompoundVal CV = V.castAs<nonloc::CompoundVal>();
27172717
nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end();
27182718
unsigned index = 0, numElements = VT->getNumElements();
2719-
BoundedRegionBindingsRef NewB = B;
2719+
LimitedRegionBindingsRef NewB = B;
27202720

27212721
for ( ; index != numElements ; ++index) {
27222722
if (VI == VE)
@@ -2755,8 +2755,8 @@ RegionStoreManager::getUniqueDefaultBinding(nonloc::LazyCompoundVal LCV) const {
27552755
return getUniqueDefaultBinding(B, LCV.getRegion());
27562756
}
27572757

2758-
std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
2759-
BoundedRegionBindingsConstRef B, const TypedValueRegion *R,
2758+
std::optional<LimitedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
2759+
LimitedRegionBindingsConstRef B, const TypedValueRegion *R,
27602760
const RecordDecl *RD, nonloc::LazyCompoundVal LCV) {
27612761
// If we try to copy a Conjured value representing the value of the whole
27622762
// struct, don't try to element-wise copy each field.
@@ -2804,7 +2804,7 @@ std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
28042804
Fields.push_back(FD);
28052805
}
28062806

2807-
BoundedRegionBindingsRef NewB = B;
2807+
LimitedRegionBindingsRef NewB = B;
28082808

28092809
for (const FieldDecl *Field : Fields) {
28102810
const FieldRegion *SourceFR = MRMgr.getFieldRegion(Field, LCV.getRegion());
@@ -2817,8 +2817,8 @@ std::optional<BoundedRegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
28172817
return NewB;
28182818
}
28192819

2820-
BoundedRegionBindingsRef
2821-
RegionStoreManager::bindStruct(BoundedRegionBindingsConstRef B,
2820+
LimitedRegionBindingsRef
2821+
RegionStoreManager::bindStruct(LimitedRegionBindingsConstRef B,
28222822
const TypedValueRegion *R, SVal V) {
28232823
llvm::TimeTraceScope TimeScope("RegionStoreManager::bindStruct",
28242824
[R]() { return R->getDescriptiveName(); });
@@ -2866,7 +2866,7 @@ RegionStoreManager::bindStruct(BoundedRegionBindingsConstRef B,
28662866
const nonloc::CompoundVal& CV = V.castAs<nonloc::CompoundVal>();
28672867
nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end();
28682868

2869-
BoundedRegionBindingsRef NewB = B;
2869+
LimitedRegionBindingsRef NewB = B;
28702870

28712871
// In C++17 aggregates may have base classes, handle those as well.
28722872
// They appear before fields in the initializer list / compound value.
@@ -2940,8 +2940,8 @@ RegionStoreManager::bindStruct(BoundedRegionBindingsConstRef B,
29402940
return NewB;
29412941
}
29422942

2943-
BoundedRegionBindingsRef
2944-
RegionStoreManager::bindAggregate(BoundedRegionBindingsConstRef B,
2943+
LimitedRegionBindingsRef
2944+
RegionStoreManager::bindAggregate(LimitedRegionBindingsConstRef B,
29452945
const TypedRegion *R, SVal Val) {
29462946
llvm::TimeTraceScope TimeScope("RegionStoreManager::bindAggregate",
29472947
[R]() { return R->getDescriptiveName(); });

0 commit comments

Comments
 (0)