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:
David Blaikie 2015-08-13 22:33:24 +00:00
parent 55477463d6
commit 01cd46abae
1 changed files with 15 additions and 21 deletions

View File

@ -149,7 +149,8 @@ typedef llvm::ImmutableMap<const MemRegion *, ClusterBindings>
namespace {
class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
ClusterBindings> {
ClusterBindings::Factory &CBFactory;
ClusterBindings::Factory *CBFactory;
public:
typedef llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>
ParentTy;
@ -158,20 +159,20 @@ public:
const RegionBindings::TreeTy *T,
RegionBindings::TreeTy::Factory *F)
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(T, F),
CBFactory(CBFactory) {}
CBFactory(&CBFactory) {}
RegionBindingsRef(const ParentTy &P, ClusterBindings::Factory &CBFactory)
: llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>(P),
CBFactory(CBFactory) {}
CBFactory(&CBFactory) {}
RegionBindingsRef add(key_type_ref K, data_type_ref D) const {
return RegionBindingsRef(static_cast<const ParentTy *>(this)->add(K, D),
CBFactory);
*CBFactory);
}
RegionBindingsRef remove(key_type_ref K) const {
return RegionBindingsRef(static_cast<const ParentTy *>(this)->remove(K),
CBFactory);
*CBFactory);
}
RegionBindingsRef addBinding(BindingKey K, SVal V) const;
@ -179,16 +180,9 @@ public:
RegionBindingsRef addBinding(const MemRegion *R,
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(const MemRegion *R, BindingKey::Kind k) const;
const ClusterBindings *lookup(const MemRegion *R) const {
return static_cast<const ParentTy*>(this)->lookup(R);
}
using llvm::ImmutableMapRef<const MemRegion *, ClusterBindings>::lookup;
RegionBindingsRef removeBinding(BindingKey K);
@ -245,10 +239,10 @@ RegionBindingsRef RegionBindingsRef::addBinding(BindingKey K, SVal V) const {
const MemRegion *Base = K.getBaseRegion();
const ClusterBindings *ExistingCluster = lookup(Base);
ClusterBindings Cluster = (ExistingCluster ? *ExistingCluster
: CBFactory.getEmptyMap());
ClusterBindings Cluster =
(ExistingCluster ? *ExistingCluster : CBFactory->getEmptyMap());
ClusterBindings NewCluster = CBFactory.add(Cluster, K, V);
ClusterBindings NewCluster = CBFactory->add(Cluster, K, V);
return add(Base, NewCluster);
}
@ -277,7 +271,7 @@ RegionBindingsRef RegionBindingsRef::removeBinding(BindingKey K) {
if (!Cluster)
return *this;
ClusterBindings NewCluster = CBFactory.remove(*Cluster, K);
ClusterBindings NewCluster = CBFactory->remove(*Cluster, K);
if (NewCluster.isEmpty())
return remove(Base);
return add(Base, NewCluster);