Wdeprecated: RegionBindingsRef are copy constructed, make sure that's safe by removing the unnecessary user-declared copy assignment operator
The user-defined copy assignment looks like it was working around the presence of a reference member (that probably doesn't change in the copy assignment cases present in the program). Rather than continuing this - just change the reference to a pointer and let all the special members be defined implicitly. llvm-svn: 244974
This commit is contained in:
parent
55477463d6
commit
01cd46abae
|
@ -149,7 +149,8 @@ typedef llvm::ImmutableMap<const MemRegion *, ClusterBindings>
|
||||||
namespace {
|
namespace {
|
||||||
class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
|
class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
|
||||||
ClusterBindings> {
|
ClusterBindings> {
|
||||||
ClusterBindings::Factory &CBFactory;
|
ClusterBindings::Factory *CBFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>
|
typedef llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>
|
||||||
ParentTy;
|
ParentTy;
|
||||||
|
@ -158,20 +159,20 @@ public:
|
||||||
const RegionBindings::TreeTy *T,
|
const RegionBindings::TreeTy *T,
|
||||||
RegionBindings::TreeTy::Factory *F)
|
RegionBindings::TreeTy::Factory *F)
|
||||||
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(T, F),
|
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(T, F),
|
||||||
CBFactory(CBFactory) {}
|
CBFactory(&CBFactory) {}
|
||||||
|
|
||||||
RegionBindingsRef(const ParentTy &P, ClusterBindings::Factory &CBFactory)
|
RegionBindingsRef(const ParentTy &P, ClusterBindings::Factory &CBFactory)
|
||||||
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(P),
|
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(P),
|
||||||
CBFactory(CBFactory) {}
|
CBFactory(&CBFactory) {}
|
||||||
|
|
||||||
RegionBindingsRef add(key_type_ref K, data_type_ref D) const {
|
RegionBindingsRef add(key_type_ref K, data_type_ref D) const {
|
||||||
return RegionBindingsRef(static_cast<const ParentTy *>(this)->add(K, D),
|
return RegionBindingsRef(static_cast<const ParentTy *>(this)->add(K, D),
|
||||||
CBFactory);
|
*CBFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionBindingsRef remove(key_type_ref K) const {
|
RegionBindingsRef remove(key_type_ref K) const {
|
||||||
return RegionBindingsRef(static_cast<const ParentTy *>(this)->remove(K),
|
return RegionBindingsRef(static_cast<const ParentTy *>(this)->remove(K),
|
||||||
CBFactory);
|
*CBFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionBindingsRef addBinding(BindingKey K, SVal V) const;
|
RegionBindingsRef addBinding(BindingKey K, SVal V) const;
|
||||||
|
@ -179,16 +180,9 @@ public:
|
||||||
RegionBindingsRef addBinding(const MemRegion *R,
|
RegionBindingsRef addBinding(const MemRegion *R,
|
||||||
BindingKey::Kind k, SVal V) const;
|
BindingKey::Kind k, SVal V) const;
|
||||||
|
|
||||||
RegionBindingsRef &operator=(const RegionBindingsRef &X) {
|
|
||||||
*static_cast<ParentTy*>(this) = X;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SVal *lookup(BindingKey K) const;
|
const SVal *lookup(BindingKey K) const;
|
||||||
const SVal *lookup(const MemRegion *R, BindingKey::Kind k) const;
|
const SVal *lookup(const MemRegion *R, BindingKey::Kind k) const;
|
||||||
const ClusterBindings *lookup(const MemRegion *R) const {
|
using llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>::lookup;
|
||||||
return static_cast<const ParentTy*>(this)->lookup(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionBindingsRef removeBinding(BindingKey K);
|
RegionBindingsRef removeBinding(BindingKey K);
|
||||||
|
|
||||||
|
@ -245,10 +239,10 @@ RegionBindingsRef RegionBindingsRef::addBinding(BindingKey K, SVal V) const {
|
||||||
const MemRegion *Base = K.getBaseRegion();
|
const MemRegion *Base = K.getBaseRegion();
|
||||||
|
|
||||||
const ClusterBindings *ExistingCluster = lookup(Base);
|
const ClusterBindings *ExistingCluster = lookup(Base);
|
||||||
ClusterBindings Cluster = (ExistingCluster ? *ExistingCluster
|
ClusterBindings Cluster =
|
||||||
: CBFactory.getEmptyMap());
|
(ExistingCluster ? *ExistingCluster : CBFactory->getEmptyMap());
|
||||||
|
|
||||||
ClusterBindings NewCluster = CBFactory.add(Cluster, K, V);
|
ClusterBindings NewCluster = CBFactory->add(Cluster, K, V);
|
||||||
return add(Base, NewCluster);
|
return add(Base, NewCluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +271,7 @@ RegionBindingsRef RegionBindingsRef::removeBinding(BindingKey K) {
|
||||||
if (!Cluster)
|
if (!Cluster)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
ClusterBindings NewCluster = CBFactory.remove(*Cluster, K);
|
ClusterBindings NewCluster = CBFactory->remove(*Cluster, K);
|
||||||
if (NewCluster.isEmpty())
|
if (NewCluster.isEmpty())
|
||||||
return remove(Base);
|
return remove(Base);
|
||||||
return add(Base, NewCluster);
|
return add(Base, NewCluster);
|
||||||
|
|
Loading…
Reference in New Issue