Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value, so make sure they're copy/moveable

(return by value is in ExprEngine::processPointerEscapedOnBind and any
other call to the scanReachableSymbols function template used there)

Protect the special members in the base class to avoid slicing, and make
derived classes final so these special members don't accidentally become
public on an intermediate base which would open up the possibility of
slicing again.

llvm-svn: 244975
This commit is contained in:
David Blaikie 2015-08-13 22:50:09 +00:00
parent 01cd46abae
commit 903c29347a
7 changed files with 11 additions and 8 deletions

View File

@ -650,6 +650,12 @@ private:
};
class SymbolVisitor {
protected:
SymbolVisitor() = default;
SymbolVisitor(const SymbolVisitor &) = default;
SymbolVisitor(SymbolVisitor &&) {}
~SymbolVisitor() = default;
public:
/// \brief A visitor method invoked by ProgramStateManager::scanReachableSymbols.
///
@ -657,7 +663,6 @@ public:
/// false otherwise.
virtual bool VisitSymbol(SymbolRef sym) = 0;
virtual bool VisitMemRegion(const MemRegion *region) { return true; }
virtual ~SymbolVisitor();
};
} // end GR namespace

View File

@ -515,7 +515,7 @@ REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
REGISTER_MAP_WITH_PROGRAMSTATE(FreeReturnValue, SymbolRef, SymbolRef)
namespace {
class StopTrackingCallback : public SymbolVisitor {
class StopTrackingCallback final : public SymbolVisitor {
ProgramStateRef state;
public:
StopTrackingCallback(ProgramStateRef st) : state(st) {}

View File

@ -2678,7 +2678,7 @@ public:
} // end anonymous namespace
namespace {
class StopTrackingCallback : public SymbolVisitor {
class StopTrackingCallback final : public SymbolVisitor {
ProgramStateRef state;
public:
StopTrackingCallback(ProgramStateRef st) : state(st) {}

View File

@ -92,7 +92,7 @@ public:
REGISTER_MAP_WITH_PROGRAMSTATE(StreamMap, SymbolRef, StreamState)
namespace {
class StopTrackingCallback : public SymbolVisitor {
class StopTrackingCallback final : public SymbolVisitor {
ProgramStateRef state;
public:
StopTrackingCallback(ProgramStateRef st) : state(st) {}

View File

@ -120,7 +120,7 @@ Environment EnvironmentManager::bindExpr(Environment Env,
}
namespace {
class MarkLiveCallback : public SymbolVisitor {
class MarkLiveCallback final : public SymbolVisitor {
SymbolReaper &SymReaper;
public:
MarkLiveCallback(SymbolReaper &symreaper) : SymReaper(symreaper) {}

View File

@ -2006,7 +2006,7 @@ void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
}
namespace {
class CollectReachableSymbolsCallback : public SymbolVisitor {
class CollectReachableSymbolsCallback final : public SymbolVisitor {
InvalidatedSymbols Symbols;
public:
CollectReachableSymbolsCallback(ProgramStateRef State) {}

View File

@ -546,5 +546,3 @@ bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{
return VarContext->isParentOf(CurrentContext);
}
SymbolVisitor::~SymbolVisitor() {}