Get rid of interpreter pointer in one of the transformers. More to follow.
git-svn-id: http://root.cern.ch/svn/root/trunk@46016 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
48cd1f6b57
commit
f2d691971f
@ -13,6 +13,8 @@ namespace clang {
|
||||
}
|
||||
|
||||
namespace cling {
|
||||
class Interpreter;
|
||||
|
||||
/// \brief This interface provides a way to observe the actions of the
|
||||
/// interpreter as it does its thing. Clients can define their hooks here to
|
||||
/// implement interpreter level tools.
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "DynamicLookup.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
#include "cling/Interpreter/Interpreter.h"
|
||||
#include "cling/Interpreter/InterpreterCallbacks.h"
|
||||
#include "cling/Utils/AST.h"
|
||||
|
||||
@ -184,10 +183,10 @@ namespace {
|
||||
namespace cling {
|
||||
|
||||
// Constructors
|
||||
EvaluateTSynthesizer::EvaluateTSynthesizer(Interpreter* interp, Sema* S)
|
||||
EvaluateTSynthesizer::EvaluateTSynthesizer(Sema* S)
|
||||
: TransactionTransformer(S), m_EvalDecl(0), m_LifetimeHandlerDecl(0),
|
||||
m_LHgetMemoryDecl(0), m_DynamicExprInfoDecl(0), m_DeclContextDecl(0),
|
||||
m_CurDeclContext(0), m_Interpreter(interp), m_Context(&S->getASTContext())
|
||||
m_CurDeclContext(0), m_Context(&S->getASTContext()), m_UniqueNameCounter(0)
|
||||
{ }
|
||||
|
||||
// pin the vtable here.
|
||||
@ -422,7 +421,7 @@ namespace cling {
|
||||
// 2.1 Get unique name for the LifetimeHandler instance and
|
||||
// initialize it
|
||||
std::string UniqueName;
|
||||
m_Interpreter->createUniqueName(UniqueName);
|
||||
createUniqueName(UniqueName);
|
||||
IdentifierInfo& II = m_Context->Idents.get(UniqueName);
|
||||
|
||||
// Prepare the initialization Exprs.
|
||||
@ -876,6 +875,11 @@ namespace cling {
|
||||
return true;
|
||||
}
|
||||
|
||||
void EvaluateTSynthesizer::createUniqueName(std::string& out) {
|
||||
out = "autoGenName";
|
||||
llvm::raw_string_ostream(out) << m_UniqueNameCounter++;
|
||||
}
|
||||
|
||||
// end Helpers
|
||||
|
||||
} // end namespace cling
|
||||
|
@ -104,7 +104,6 @@ namespace cling {
|
||||
} //end namespace cling
|
||||
|
||||
namespace cling {
|
||||
class Interpreter;
|
||||
class DynamicIDHandler;
|
||||
|
||||
typedef llvm::DenseMap<clang::Stmt*, clang::Stmt*> MapTy;
|
||||
@ -190,9 +189,6 @@ namespace cling {
|
||||
/// being visited.
|
||||
clang::DeclContext* m_CurDeclContext;
|
||||
|
||||
/// \brief Stores pointer to cling, mainly used for declaration lookup.
|
||||
Interpreter* m_Interpreter;
|
||||
|
||||
/// \brief Use instead of clang::SourceRange().
|
||||
clang::SourceRange m_NoRange;
|
||||
|
||||
@ -202,9 +198,12 @@ namespace cling {
|
||||
/// \brief Use instead of clang::SourceLocation() as end location.
|
||||
clang::SourceLocation m_NoELoc;
|
||||
|
||||
/// \brief Needed for the AST transformations, owned by Sema
|
||||
/// \brief Needed for the AST transformations, owned by Sema.
|
||||
clang::ASTContext* m_Context;
|
||||
|
||||
/// \brief Counter used when we need unique names.
|
||||
unsigned long long m_UniqueNameCounter;
|
||||
|
||||
public:
|
||||
|
||||
typedef clang::StmtVisitor<EvaluateTSynthesizer, ASTNodeInfo>
|
||||
@ -212,7 +211,7 @@ namespace cling {
|
||||
|
||||
using BaseStmtVisitor::Visit;
|
||||
|
||||
EvaluateTSynthesizer(Interpreter* interp, clang::Sema* S);
|
||||
EvaluateTSynthesizer(clang::Sema* S);
|
||||
|
||||
~EvaluateTSynthesizer();
|
||||
|
||||
@ -325,6 +324,11 @@ namespace cling {
|
||||
/// \brief Gets all children of a given node.
|
||||
///
|
||||
bool GetChildren(ASTNodes& Children, clang::Stmt* Node);
|
||||
|
||||
/// \brief Creates unique name (eg. of a variable). Used internally for
|
||||
/// AST node synthesis.
|
||||
///
|
||||
void createUniqueName(std::string& out);
|
||||
/// @}
|
||||
};
|
||||
} // end namespace cling
|
||||
|
@ -63,7 +63,7 @@ namespace cling {
|
||||
CreateSLocOffsetGenerator();
|
||||
|
||||
// Add transformers to the IncrementalParser, which owns them
|
||||
m_TTransformers.push_back(new EvaluateTSynthesizer(interp, &CI->getSema()));
|
||||
m_TTransformers.push_back(new EvaluateTSynthesizer(&CI->getSema()));
|
||||
|
||||
m_TTransformers.push_back(new DeclExtractor(&getCI()->getSema()));
|
||||
m_TTransformers.push_back(new ValuePrinterSynthesizer(interp, &CI->getSema()));
|
||||
|
Loading…
Reference in New Issue
Block a user