cling/lib/Interpreter/TransactionTransformer.h
Vassil Vassilev e087402f78 * Implement interpreter callbacks, which the Interpreter owns.
* Implement new callback functions - on transaction committed and transaction unloaded.
* Publish the Transaction class so that it can be visible by TCintWithCling.
* Publish the CompilationOptions needed by Transaction.
* Fix the references of Transaction and CompilationOptions.
* Forward declare where possible.
* Add missing keywords.
* Improve include style.


git-svn-id: http://root.cern.ch/svn/root/trunk@46264 27541ba8-7e3a-0410-8455-c3a389f83636
2012-10-02 10:30:25 +00:00

73 lines
2.2 KiB
C++

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Vassil Vassilev <vvasilev@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_TRANSACTION_TRANSFORMER_H
#define CLING_TRANSACTION_TRANSFORMER_H
namespace clang {
class Sema;
}
namespace cling {
class Transaction;
///\brief Inherit from that class if you want to change/analyse declarations
/// from the last input before code is generated.
///
class TransactionTransformer {
protected:
clang::Sema* m_Sema;
///\brief Transaction being transformed.
Transaction* m_Transaction;
public:
///\brief Initializes a new transaction transformer.
///
///\param[in] S - The semantic analysis object.
///
TransactionTransformer(clang::Sema* S): m_Sema(S), m_Transaction(0) {}
virtual ~TransactionTransformer();
///\brief Retrieves a pointer to the semantic analysis object used for this
/// transaction transform.
///
clang::Sema* getSemaPtr() const { return m_Sema; }
///\brief Retreives the transaction being currently transformed.
///
Transaction* getTransaction() { return m_Transaction; }
///\brief Retreives the transaction being currently transformed.
///
const Transaction* getTransaction() const { return m_Transaction; }
void setTransaction(Transaction* T) { m_Transaction = T; }
///\brief The method that does the transformation of a transaction into
/// another. If forwards to the protected virtual Transform method, which
/// does the actual transformation.
///
///\param[in] T - The transaction to be transformed.
///\returns The transformed transaction.
///
Transaction* TransformTransaction(Transaction& T) {
m_Transaction = &T;
Transform();
return m_Transaction;
}
protected:
///\brief Transforms the current transaction.
///
/// Subclasses may override it in order to provide the needed behavior.
///
virtual void Transform() = 0;
};
} // end namespace cling
#endif // CLING_TRANSACTION_TRANSFORMER_H