]> granicus.if.org Git - clang/commitdiff
Remove dead malloc symbols from the symbol-state map.
authorJordy Rose <jediknil@belkadan.com>
Wed, 18 Aug 2010 04:33:47 +0000 (04:33 +0000)
committerJordy Rose <jediknil@belkadan.com>
Wed, 18 Aug 2010 04:33:47 +0000 (04:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111353 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/MallocChecker.cpp

index 7aa89e0998992cfca54e9a3fa1c5a3df7e2a02c0..0076e1e868711dcc247d12aba57b8bbdbcd3030b 100644 (file)
@@ -567,6 +567,7 @@ void MallocChecker::EvalDeadSymbols(CheckerContext &C,SymbolReaper &SymReaper) {
 
   const GRState *state = C.getState();
   RegionStateTy RS = state->get<RegionState>();
+  RegionStateTy::Factory &F = state->get_context<RegionState>();
 
   for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
     if (SymReaper.isDead(I->first)) {
@@ -580,8 +581,14 @@ void MallocChecker::EvalDeadSymbols(CheckerContext &C,SymbolReaper &SymReaper) {
           C.EmitReport(R);
         }
       }
+
+      // Remove the dead symbol from the map.
+      RS = F.Remove(RS, I->first);
     }
   }
+
+  state = state->set<RegionState>(RS);
+  C.GenerateNode(state);
 }
 
 void MallocChecker::EvalEndPath(GREndPathNodeBuilder &B, void *tag,