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.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141821 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index 7cff6fd..f82f5ae 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -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