[Lldb-commits] [lldb] r141821 - in /lldb/trunk/source/Expression: ClangExpressionDeclMap.cpp ClangUserExpression.cpp
Sean Callanan
scallanan at apple.com
Wed Oct 12 15:20:02 PDT 2011
Author: spyffe
Date: Wed Oct 12 17:20:02 2011
New Revision: 141821
URL: http://llvm.org/viewvc/llvm-project?rev=141821&view=rev
Log:
Extended the lifetime of Clang parser objects to the
lifetime of ClangExpressionDeclMap. This allows
ClangExpressionVariables found during parsing to be
queried for their containing namespaces during
expression execution.
Other clients (like ClangFunction) explicitly delete
this state, so they should not result in any memory
leaks.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141821&r1=141820&r2=141821&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 17:20:02 2011
@@ -61,6 +61,11 @@
ClangExpressionDeclMap::~ClangExpressionDeclMap()
{
+ // Note: The model is now that the parser's AST context and all associated
+ // data does not vanish until the expression has been executed. This means
+ // that valuable lookup data (like namespaces) doesn't vanish, but
+
+ DidParse();
DidDematerialize();
DisableStructVars();
}
@@ -933,6 +938,9 @@
if (expr_var_sp)
{
+ if (!expr_var_sp->m_parser_vars.get())
+ return Value();
+
const ConstString &name(expr_var_sp->GetName());
TypeFromUser type(expr_var_sp->GetTypeFromUser());
@@ -1621,7 +1629,7 @@
Process *process = exe_ctx.GetProcessPtr();
StackFrame *frame = exe_ctx.GetFramePtr();
- if (!frame || !process || !target)
+ if (!frame || !process || !target || !m_parser_vars.get() || !expr_var->m_parser_vars.get())
return false;
// Vital information about the value
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=141821&r1=141820&r2=141821&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Oct 12 17:20:02 2011
@@ -276,9 +276,7 @@
log->Printf("Data buffer contents:\n%s", dump_string.GetString().c_str());
}
-
- m_expr_decl_map->DidParse();
-
+
if (jit_error.Success())
{
if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
@@ -449,6 +447,7 @@
error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
return false;
}
+
return true;
}
More information about the lldb-commits
mailing list