rdar://problem/10501020

ClangASTSource::~ClangASTSource() was calling

    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();

which had the side effect of deleting this very ClangASTSource instance.  Not good.
Change it to

    // We are in the process of destruction, don't create clang ast context on demand
    // by passing false to Target::GetScratchClangASTContext(create_on_demand).
    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false);

The Target::GetScratchClangASTContext(bool create_on_demand=true) has a new signature.

llvm-svn: 145537
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 53e8ccf..978ab5e 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1335,10 +1335,10 @@
 }
 
 ClangASTContext *
-Target::GetScratchClangASTContext()
+Target::GetScratchClangASTContext(bool create_on_demand)
 {
     // Now see if we know the target triple, and if so, create our scratch AST context:
-    if (m_scratch_ast_context_ap.get() == NULL && m_arch.IsValid())
+    if (m_scratch_ast_context_ap.get() == NULL && m_arch.IsValid() && create_on_demand)
     {
         m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
         m_scratch_ast_source_ap.reset (new ClangASTSource(GetSP()));