Make sure that ClangExpressionDeclMap doesn't
live beyont parsing. This is important because
all the ClangASTImporter::Minions for a parser's
ASTContext are cleared when ClangExpressionDeclMap
is deleted.
This resolves many hard-to-reproduce crashes,
especially ones involving breakpoint conditions.
<rdar://problem/14775391>
llvm-svn: 189080
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index 7f09f6f..1e52ce2 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -508,6 +508,9 @@
if (!m_expr_decl_map->WillParse(exe_ctx, m_materializer_ap.get()))
{
error_stream.PutCString ("error: current process state is unsuitable for expression parsing\n");
+
+ m_expr_decl_map.reset(); // We are being careful here in the case of breakpoint conditions.
+
return false;
}
@@ -525,7 +528,7 @@
{
error_stream.Printf ("error: %d errors parsing expression\n", num_errors);
- m_expr_decl_map->DidParse();
+ m_expr_decl_map.reset(); // We are being careful here in the case of breakpoint conditions.
return false;
}
@@ -540,6 +543,8 @@
exe_ctx,
m_can_interpret,
execution_policy);
+
+ m_expr_decl_map.reset(); // Make this go away since we don't need any of its state after parsing. This also gets rid of any ClangASTImporter::Minions.
if (jit_error.Success())
{