diff options
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 9bf8cd5f295..6da103e870a 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -577,12 +577,18 @@ ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, ExecutionConte { register_execution_unit = true; } + + // If there is more than one external function in the execution + // unit, it needs to keep living even if it's not top level, because + // the result could refer to that function. + + if (m_execution_unit_sp->GetJittedFunctions().size() > 1) + { + register_execution_unit = true; + } if (register_execution_unit) { - // We currently key off there being more than one external function in the execution - // unit to determine whether it needs to live in the process. - llvm::cast<PersistentExpressionState>( exe_ctx.GetTargetPtr()->GetPersistentExpressionStateForLanguage(m_language)) ->RegisterExecutionUnit(m_execution_unit_sp); |