cling/lib/Interpreter/TransactionTransformer.h

72 lines
2.2 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.
//------------------------------------------------------------------------------
#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; }
2014-08-04 06:05:42 +04:00
///\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 true on success.
///
bool TransformTransaction(Transaction& T);
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