Erase takes iterator and sets the wrapper fd to 0 if the wrapper is being erased.

This commit is contained in:
Vassil Vassilev 2013-10-24 11:46:42 -05:00 committed by sftnight
parent f531e3d196
commit bd34a1ca16
2 changed files with 6 additions and 4 deletions

View File

@ -373,7 +373,7 @@ namespace cling {
///\brief Erases an element at given position.
///
void erase(size_t pos);
void erase(iterator pos);
///\brief Resets empty transaction so that it could be reused.
///

View File

@ -77,7 +77,7 @@ namespace cling {
if ((*this)[i].m_DGR.isNull() && (*this)[i].m_Call == kCCINone) {
++markerPos;
if (nestedPos == markerPos) {
erase(i);
erase(m_DeclQueue.begin() + i);
break;
}
}
@ -171,9 +171,11 @@ namespace cling {
forceAppend(DelayCallInfo(DeclGroupRef(D), kCCIHandleTopLevelDecl));
}
void Transaction::erase(size_t pos) {
void Transaction::erase(iterator pos) {
assert(!empty() && "Erasing from an empty transaction.");
m_DeclQueue.erase(decls_begin() + pos);
m_DeclQueue.erase(pos);
if (!pos->m_DGR.isNull() && m_WrapperFD == *pos->m_DGR.begin())
m_WrapperFD = 0;
}
void Transaction::DelayCallInfo::dump() const {