From e66ea9ad584108c27576671e31ea1200289bf240 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Fri, 18 Dec 2020 17:02:55 +0100 Subject: [PATCH] Allow unloading of Transactions that have not been committed: If Lookup fails to instantiate, its transaction should not be committed, as we know it's useless and must be unloaded as it might contain invalid Decls. But that means Lookup needs to unload a non-committed transaction. --- lib/Interpreter/IncrementalParser.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index 525f038e..40e03332 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -697,11 +697,18 @@ namespace cling { Parent->removeNestedTransaction(&T); T.setParent(0); } else { - // Remove from the queue - assert(&T == m_Transactions.back() && "Out of order transaction removal"); - m_Transactions.pop_back(); - if (!m_Transactions.empty()) - m_Transactions.back()->setNext(0); + if (&T == m_Transactions.back()) { + // Remove from the queue + m_Transactions.pop_back(); + if (!m_Transactions.empty()) + m_Transactions.back()->setNext(0); + } else { + // If T is not the last transaction it must not be a previous + // transaction either, but a "disconnected" one, i.e. one that + // was not yet committed. + assert(std::find(m_Transactions.begin(), m_Transactions.end(), &T) + == m_Transactions.end() && "Out of order transaction removal"); + } } m_TransactionPool->releaseTransaction(&T);