cling/lib/Interpreter/TransactionUnloader.h

67 lines
2.0 KiB
C
Raw Normal View History

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Vassil Vassilev <vvasilev@cern.ch>
2014-01-07 14:08:37 +04:00
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
2014-03-27 20:30:09 +04:00
#ifndef CLING_TRANSACTION_UNLOADER
#define CLING_TRANSACTION_UNLOADER
namespace llvm {
class ExecutionEngine;
}
namespace clang {
class CodeGenerator;
2014-03-28 17:53:34 +04:00
class CompilerInstance;
2014-02-27 13:47:36 +04:00
class Decl;
class Sema;
}
namespace cling {
class Transaction;
///\brief A simple eraser class that removes already created AST Nodes.
///
2014-03-27 20:30:09 +04:00
class TransactionUnloader {
private:
clang::Sema* m_Sema;
clang::CodeGenerator* m_CodeGen;
llvm::ExecutionEngine* m_EEngine;
public:
2014-03-27 20:30:09 +04:00
TransactionUnloader(clang::Sema* S, clang::CodeGenerator* CG,
llvm::ExecutionEngine* EE);
~TransactionUnloader();
///\brief Rolls back given transaction from the AST.
///
/// Removing includes reseting various internal stuctures in the compiler to
2014-02-27 13:47:36 +04:00
/// their previous states. For example it resets the lookup tables if the
/// declaration has name and can be looked up; Unloads the redeclaration
/// chain if the declaration was redeclarable and so on.
/// Note1: that the code generated for the declaration is not removed yet.
/// Note2: does not do dependency analysis.
///
///\param[in] T - The transaction to be removed.
///\returns true on success.
///
bool RevertTransaction(Transaction* T);
2014-02-27 13:47:36 +04:00
///\brief Unloads a single decl. It must not be in any other transaction.
2014-02-27 13:47:36 +04:00
/// This doesn't do dependency tracking. Use with caution.
///
///\param[in] D - The decl to be removed.
///
///\returns true on success
///
bool UnloadDecl(clang::Decl* D);
};
} // end namespace cling
#endif // CLING_AST_NODE_ERASER