Change the state when the transaction gets returned in the pool. Simplifies debugging.

This commit is contained in:
Vassil Vassilev 2013-08-04 18:38:42 +02:00 committed by sftnight
parent 67a8bbfd1f
commit 3643b28116
2 changed files with 10 additions and 2 deletions

View File

@ -190,7 +190,11 @@ namespace cling {
/// \}
State getState() const { return static_cast<State>(m_State); }
void setState(State val) { m_State = val; }
void setState(State val) {
assert(m_State != kNumStates
&& "Transaction already returned in the pool");
m_State = val;
}
IssuedDiags getIssuedDiags() const {
return static_cast<IssuedDiags>(m_IssuedDiags);
@ -368,6 +372,7 @@ namespace cling {
void printStructureBrief(size_t nindent = 0) const;
friend class TransactionPool;
private:
bool comesFromASTReader(clang::DeclGroupRef DGR) const;
};

View File

@ -58,7 +58,9 @@ namespace cling {
Transaction* takeTransaction() {
if (m_Transactions.size() == 0)
RefillPool();
return m_Transactions.pop_back_val();
Transaction* T = m_Transactions.pop_back_val();
T->m_State = Transaction::kCollecting;
return T;
}
void releaseTransaction(Transaction* T) {
@ -66,6 +68,7 @@ namespace cling {
assert(T->getState() == Transaction::kCompleted
&& "Transaction must completed!");
T->reset();
T->m_State = Transaction::kNumStates;
m_Transactions.push_back(T);
}
#undef TRANSACTIONS_IN_BLOCK