Add methods to remove a GDM entry.
Instead of setting the ReturnExpr GDM to NULL, remove it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99470 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp
index b552185..6a8466d 100644
--- a/lib/Checker/GRExprEngine.cpp
+++ b/lib/Checker/GRExprEngine.cpp
@@ -1330,7 +1330,7 @@
SVal RetVal = state->getSVal(ReturnedExpr);
state = state->BindExpr(CE, RetVal);
// Clear the return expr GDM.
- state = state->set<ReturnExpr>(0);
+ state = state->remove<ReturnExpr>();
}
// Bind the constructed object value to CXXConstructExpr.
diff --git a/lib/Checker/GRState.cpp b/lib/Checker/GRState.cpp
index 2defbcd..f2952bc 100644
--- a/lib/Checker/GRState.cpp
+++ b/lib/Checker/GRState.cpp
@@ -227,6 +227,18 @@
return getPersistentState(NewSt);
}
+const GRState *GRStateManager::removeGDM(const GRState *state, void *Key) {
+ GRState::GenericDataMap OldM = state->getGDM();
+ GRState::GenericDataMap NewM = GDMFactory.Remove(OldM, Key);
+
+ if (NewM == OldM)
+ return state;
+
+ GRState NewState = *state;
+ NewState.GDM = NewM;
+ return getPersistentState(NewState);
+}
+
//===----------------------------------------------------------------------===//
// Utility.
//===----------------------------------------------------------------------===//