From 5732bb3b0857efff6402fd3dbe862ecb36c70d8a Mon Sep 17 00:00:00 2001 From: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch> Date: Tue, 23 Apr 2013 21:36:41 +0000 Subject: [PATCH] Move the set of llvm::Module from the Transaction ctor to commitTransaction. git-svn-id: http://root.cern.ch/svn/root/trunk@49295 27541ba8-7e3a-0410-8455-c3a389f83636 --- core/meta/src/TClingCallFunc.cxx | 2 +- core/meta/src/TClingCallbacks.cxx | 4 ++-- interpreter/cling/include/cling/Interpreter/Transaction.h | 5 +++-- interpreter/cling/lib/Interpreter/IncrementalParser.cpp | 7 ++----- interpreter/cling/lib/Interpreter/Transaction.cpp | 3 +-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/core/meta/src/TClingCallFunc.cxx b/core/meta/src/TClingCallFunc.cxx index 0b7abb7c146..848dbaffeed 100644 --- a/core/meta/src/TClingCallFunc.cxx +++ b/core/meta/src/TClingCallFunc.cxx @@ -494,7 +494,7 @@ void TClingCallFunc::CodeGenDecl(const clang::FunctionDecl* FD) { CO.Debug = 0; CO.CodeGeneration = 1; - cling::Transaction T(CO, fInterp->getModule()); + cling::Transaction T(CO); T.append(const_cast<clang::FunctionDecl*>(FD)); T.setState(cling::Transaction::kCompleted); diff --git a/core/meta/src/TClingCallbacks.cxx b/core/meta/src/TClingCallbacks.cxx index b814b4f058c..365f3826f9e 100644 --- a/core/meta/src/TClingCallbacks.cxx +++ b/core/meta/src/TClingCallbacks.cxx @@ -247,7 +247,7 @@ bool TClingCallbacks::tryFindROOTSpecialInternal(LookupResult &R, Scope *S) { CO.Debug = 0; CO.CodeGeneration = 1; - cling::Transaction T(CO, /*llvm::Module=*/0); + cling::Transaction T(CO); T.append(VD); T.setState(cling::Transaction::kCompleted); @@ -393,7 +393,7 @@ void TClingCallbacks::TransactionCommitted(const Transaction &T) { // return; if (fFirstRun && !T.empty()) { // Before setting up the callbacks register what cling have seen during init. - cling::Transaction TPrev(T.getCompilationOpts(), T.getModule()); + cling::Transaction TPrev(T.getCompilationOpts()); clang::DeclGroupRef TDRG = T.getFirstDecl(); TPrev.append(TDRG.getSingleDecl()->getASTContext().getTranslationUnitDecl()); diff --git a/interpreter/cling/include/cling/Interpreter/Transaction.h b/interpreter/cling/include/cling/Interpreter/Transaction.h index 7731ebc86c3..d677733712f 100644 --- a/interpreter/cling/include/cling/Interpreter/Transaction.h +++ b/interpreter/cling/include/cling/Interpreter/Transaction.h @@ -105,9 +105,9 @@ namespace cling { public: - Transaction(const CompilationOptions& Opts, llvm::Module* M) + Transaction(const CompilationOptions& Opts) : m_DeclQueue(0), m_NestedTransactions(0), m_Parent(0), - m_State(kCollecting), m_IssuedDiags(kNone), m_Opts(Opts), m_Module(M), + m_State(kCollecting), m_IssuedDiags(kNone), m_Opts(Opts), m_Module(0), m_WrapperFD(0), m_Next(0) { assert(sizeof(*this)<65 && "Transaction class grows! Is that expected?"); } @@ -298,6 +298,7 @@ namespace cling { } llvm::Module* getModule() const { return m_Module; } + void setModule(llvm::Module* M) { m_Module = M ; } clang::FunctionDecl* getWrapperFD() const { return m_WrapperFD; } diff --git a/interpreter/cling/lib/Interpreter/IncrementalParser.cpp b/interpreter/cling/lib/Interpreter/IncrementalParser.cpp index 5646024e772..1cbc0c96680 100644 --- a/interpreter/cling/lib/Interpreter/IncrementalParser.cpp +++ b/interpreter/cling/lib/Interpreter/IncrementalParser.cpp @@ -134,11 +134,7 @@ namespace cling { Transaction* IncrementalParser::beginTransaction(const CompilationOptions& Opts) { - llvm::Module* M = 0; - if (hasCodeGenerator()) - M = getCodeGenerator()->GetModule(); - - Transaction* NewCurT = new Transaction(Opts, M); + Transaction* NewCurT = new Transaction(Opts); Transaction* OldCurT = m_Consumer->getTransaction(); m_Consumer->setTransaction(NewCurT); // If we are in the middle of transaction and we see another begin @@ -320,6 +316,7 @@ namespace cling { } getCodeGenerator()->HandleTranslationUnit(getCI()->getASTContext()); + T->setModule(getCodeGenerator()->GetModule()); // 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 diff --git a/interpreter/cling/lib/Interpreter/Transaction.cpp b/interpreter/cling/lib/Interpreter/Transaction.cpp index 1af79539eef..ad9bc18eeff 100644 --- a/interpreter/cling/lib/Interpreter/Transaction.cpp +++ b/interpreter/cling/lib/Interpreter/Transaction.cpp @@ -38,8 +38,7 @@ namespace cling { Opts.ValuePrinting = CompilationOptions::VPDisabled; Opts.ResultEvaluation = 0; Opts.DynamicScoping = 0; - subTransactionWhileCommitting - = new Transaction(Opts, getModule()); + subTransactionWhileCommitting = new Transaction(Opts); addNestedTransaction(subTransactionWhileCommitting); } subTransactionWhileCommitting->append(DCI); -- GitLab