Add the transaction to define its lifetime.

This should be migrated to use unique_ptr in the interfaces instead
of relying on comments...
This commit is contained in:
Axel Naumann 2015-02-10 11:19:35 +01:00 committed by sftnight
parent 9bd2a08dd2
commit eb75ab36ef
3 changed files with 9 additions and 2 deletions

View File

@ -501,7 +501,7 @@ namespace cling {
///\brief Generates code for all Decls of a transaction.
///
/// @param[in] T - The cling::Transaction that contains the declarations and
/// the compilation/generation options.
/// the compilation/generation options. Takes ownership!
///
///\returns Whether the operation was fully successful.
///

View File

@ -175,6 +175,12 @@ namespace cling {
///
const Transaction* getCurrentTransaction() const;
///\brief Add a user-generated transaction.
void addTransaction(Transaction* T) {
m_Transactions.push_back(T);
}
///\brief Returns the list of transactions seen by the interpreter.
/// Intentionally makes a copy - that function is meant to be use for debug
/// purposes.

View File

@ -626,8 +626,9 @@ namespace cling {
Interpreter::CompilationResult Interpreter::emitAllDecls(Transaction* T) {
assert(!isInSyntaxOnlyMode() && "No CodeGenerator?");
m_IncrParser->addTransaction(T);
m_IncrParser->markWholeTransactionAsUsed(T);
m_IncrParser->codeGenTransaction(T);
m_IncrParser->commitTransaction(T);
// The static initializers might run anything and can thus cause more
// decls that need to end up in a transaction. But this one is done