summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-10-12 22:20:02 +0000
committerSean Callanan <scallanan@apple.com>2011-10-12 22:20:02 +0000
commite3aef1d063edbe910c294821386553d67f42b16a (patch)
tree8923506abb72ef5e0f2eca71c4672ae4da5e123c /lldb/source/Expression/ClangExpressionDeclMap.cpp
parent154a967c231f9faba0ca7ec732abde802a3e4fd0 (diff)
downloadbcm5719-llvm-e3aef1d063edbe910c294821386553d67f42b16a.tar.gz
bcm5719-llvm-e3aef1d063edbe910c294821386553d67f42b16a.zip
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
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 7cff6fd2974..f82f5ae2e7e 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -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
OpenPOWER on IntegriCloud