Add a callback for start/finish code generation.
When we are generating code, CodeGen automatically tries to complete decl's redeclaration chain. This ends up a call to the external sources, one of which is our global module index (GMI). The semantics of the GMI is to aid the frontend, that is to automatically import missing modules based on the typed *by the user* identifiers. It does not intend to aid the code generation by any means. Currently this happens when completing chains for existing identifiers such as 'volume' which happens to be an indentifier part of TMVA.pcm, too. Thus, CodeGen unintentionally loads the module of TMVA. This is an overkill, but worse -- it brings recursiveness to the identifier resolution system. This patch disables looking in the GMI at codegen time.
This commit is contained in:
parent
35641c2c8b
commit
c7eb512358
@ -141,6 +141,20 @@ namespace cling {
|
||||
///
|
||||
virtual void TransactionCommitted(const Transaction&) {}
|
||||
|
||||
/// This callback is invoked whenever interpreter has started code
|
||||
/// generation for the transaction.
|
||||
///
|
||||
///\param[in] - The transaction that is being codegen-ed.
|
||||
///
|
||||
virtual void TransactionCodeGenStarted(const Transaction&) {}
|
||||
|
||||
/// This callback is invoked whenever interpreter has finished code
|
||||
/// generation for the transaction.
|
||||
///
|
||||
///\param[in] - The transaction that is being codegen-ed.
|
||||
///
|
||||
virtual void TransactionCodeGenFinished(const Transaction&) {}
|
||||
|
||||
///\brief This callback is invoked whenever interpreter has reverted a
|
||||
/// transaction that has been fully committed.
|
||||
///
|
||||
|
@ -657,6 +657,9 @@ namespace cling {
|
||||
// This llvm::Module is done; finalize it and pass it to the execution
|
||||
// engine.
|
||||
if (!T->isNestedTransaction() && hasCodeGenerator()) {
|
||||
if (InterpreterCallbacks* callbacks = m_Interpreter->getCallbacks())
|
||||
callbacks->TransactionCodeGenStarted(*T);
|
||||
|
||||
// The initializers are emitted to the symbol "_GLOBAL__sub_I_" + filename.
|
||||
// Make that unique!
|
||||
deserT = beginTransaction(CompilationOptions());
|
||||
@ -678,6 +681,9 @@ namespace cling {
|
||||
Diags.getClient()->clear();
|
||||
}
|
||||
|
||||
if (InterpreterCallbacks* callbacks = m_Interpreter->getCallbacks())
|
||||
callbacks->TransactionCodeGenFinished(*T);
|
||||
|
||||
// Create a new module.
|
||||
StartModule();
|
||||
}
|
||||
|
@ -83,6 +83,18 @@ namespace cling {
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionCodeGenStarted(const Transaction& T) override {
|
||||
for (auto&& cb : m_Callbacks) {
|
||||
cb->TransactionCodeGenStarted(T);
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionCodeGenFinished(const Transaction& T) override {
|
||||
for (auto&& cb : m_Callbacks) {
|
||||
cb->TransactionCodeGenFinished(T);
|
||||
}
|
||||
}
|
||||
|
||||
bool LibraryLoadingFailed(const std::string& errmessage, const std::string& libStem, bool permanent,
|
||||
bool resolved) override {
|
||||
for (auto&& cb : m_Callbacks) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user