mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 21:55:39 +08:00
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. llvm-svn: 141821
This commit is contained in:
@@ -61,6 +61,11 @@ ClangExpressionDeclMap::ClangExpressionDeclMap (bool keep_result_in_memory) :
|
||||
|
||||
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 @@ ClangExpressionDeclMap::LookupDecl (clang::NamedDecl *decl)
|
||||
|
||||
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 @@ ClangExpressionDeclMap::DoMaterializeOneVariable
|
||||
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
|
||||
|
||||
@@ -276,9 +276,7 @@ ClangUserExpression::Parse (Stream &error_stream,
|
||||
|
||||
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 @@ ClangUserExpression::FinalizeJITExecution (Stream &error_stream,
|
||||
error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user