]> granicus.if.org Git - clang/commitdiff
Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value...
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 13 Aug 2015 22:50:09 +0000 (22:50 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 13 Aug 2015 22:50:09 +0000 (22:50 +0000)
(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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244975 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
lib/StaticAnalyzer/Checkers/MallocChecker.cpp
lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
lib/StaticAnalyzer/Core/Environment.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp

index 1ca96a2231478491575b18e278e9b9f21811000c..e709b1f589b102c6041e56d028da2a3bd3238724 100644 (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
index a9e08653b24198697e1f8b375b0ea4020f53c438..006807246baf820ddafd877d447fccc3999bcbf1 100644 (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) {}
index 6ee87a561e02039a74a9ad792d8a612e5b1b5fa7..9369aeb5446d9447fb0849d7904a35d5d13f3b76 100644 (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) {}
index c22e78b7eb62a189e04d1017224185f4ac1d6dfd..e1b2eaf46d829a7770b50416415a6edb83856190 100644 (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) {}
index ae5a4cc8b4aad0efbcca19742d467e189ecd3642..d70f2cefa916be87c1a870c33a56e12b30730a95 100644 (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) {}
index a6a0840555318447e3927e54890f208fda43fc73..335ba5afa532931a681b64a310ccc3c77e3e7186 100644 (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) {}
index cca0461a47486bea84611b8e191e085b3c98b0a9..d6f224c719ac976606f2ec3816c05dec295b3011 100644 (file)
@@ -546,5 +546,3 @@ bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{
 
   return VarContext->isParentOf(CurrentContext);
 }
-
-SymbolVisitor::~SymbolVisitor() {}