diff options
author | Sean Callanan <scallanan@apple.com> | 2016-03-26 00:30:40 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2016-03-26 00:30:40 +0000 |
commit | 47cca78efa07fcf94507e1b84b098f984493cadc (patch) | |
tree | 52b9119907cc16e6a7c58eeb912e85cc9ba59bbd /lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp | |
parent | 7111bb5206c64a38d4e0a03c70bb3878cda50ddc (diff) | |
download | bcm5719-llvm-47cca78efa07fcf94507e1b84b098f984493cadc.tar.gz bcm5719-llvm-47cca78efa07fcf94507e1b84b098f984493cadc.zip |
Record all translation units with more than one function in them (e.g., blocks).
Blocks and lambdas have their implementation functions stored in the IR for an
expression. If we put the block/lambda into a result variable it needs to stay
around. As a heuristic, remember any execution unit that has more than one
function in it.
<rdar://problem/22864976>
llvm-svn: 264483
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); |