Use compiled Module for stored states

Since the upgrade to LLVM 13, the JIT infrastructure takes ownership
of the Module. After JIT compilation, we get back a (const) pointer
to the compiled module.

This fixes the Cling test ErrorRecovery/StoredState.C.
This commit is contained in:
Jonas Hahnfeld 2023-03-08 15:37:32 +01:00 committed by jenkins
parent 33de07df48
commit 1499c8c74f

View File

@ -692,7 +692,7 @@ namespace cling {
CodeGenerator* CG = m_IncrParser->getCodeGenerator();
ClangInternalState* state = new ClangInternalState(
getCI()->getASTContext(), getCI()->getPreprocessor(),
getLastTransaction()->getModule(), CG, name);
getLastTransaction()->getCompiledModule(), CG, name);
m_StoredStates.push_back(state);
}
@ -1500,7 +1500,7 @@ namespace cling {
T.setUnloading();
// Clear any stored states that reference the llvm::Module.
// Do it first in case
auto Module = T.getModule();
const auto *Module = T.getCompiledModule();
if (Module && !m_StoredStates.empty()) {
const auto Predicate = [&Module](const ClangInternalState* S) {
return S->getModule() == Module;