[Lldb-commits] [lldb] r264483 - Record all translation units with more than one function in them (e.g., blocks).

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 25 17:30:40 PDT 2016


Author: spyffe
Date: Fri Mar 25 19:30:40 2016
New Revision: 264483

URL: http://llvm.org/viewvc/llvm-project?rev=264483&view=rev
Log:
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>

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=264483&r1=264482&r2=264483&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp Fri Mar 25 19:30:40 2016
@@ -577,12 +577,18 @@ ClangUserExpression::Parse(DiagnosticMan
         {
             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);




More information about the lldb-commits mailing list