forked from OSchip/llvm-project
Add methods to remove a GDM entry.
Instead of setting the ReturnExpr GDM to NULL, remove it. llvm-svn: 99470
This commit is contained in:
parent
563fe3cc12
commit
b6e1c13c36
|
@ -302,6 +302,8 @@ public:
|
|||
template<typename T>
|
||||
const GRState *remove(typename GRStateTrait<T>::key_type K,
|
||||
typename GRStateTrait<T>::context_type C) const;
|
||||
template <typename T>
|
||||
const GRState *remove() const;
|
||||
|
||||
template<typename T>
|
||||
const GRState *set(typename GRStateTrait<T>::data_type D) const;
|
||||
|
@ -464,6 +466,7 @@ public:
|
|||
|
||||
// Methods that manipulate the GDM.
|
||||
const GRState* addGDM(const GRState* St, void* Key, void* Data);
|
||||
const GRState *removeGDM(const GRState *state, void *Key);
|
||||
|
||||
// Methods that query & manipulate the Store.
|
||||
|
||||
|
@ -528,6 +531,10 @@ public:
|
|||
GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Remove(st->get<T>(), K, C)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const GRState *remove(const GRState *st) {
|
||||
return removeGDM(st, GRStateTrait<T>::GDMIndex());
|
||||
}
|
||||
|
||||
void* FindGDMContext(void* index,
|
||||
void* (*CreateContext)(llvm::BumpPtrAllocator&),
|
||||
|
@ -702,6 +709,11 @@ const GRState *GRState::remove(typename GRStateTrait<T>::key_type K,
|
|||
return getStateManager().remove<T>(this, K, C);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const GRState *GRState::remove() const {
|
||||
return getStateManager().remove<T>(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const GRState *GRState::set(typename GRStateTrait<T>::data_type D) const {
|
||||
return getStateManager().set<T>(this, D);
|
||||
|
|
|
@ -1330,7 +1330,7 @@ void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
|
|||
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.
|
||||
|
|
|
@ -227,6 +227,18 @@ const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){
|
|||
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.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue