Create the scratch AST context in the accessor function, not
only when the executable is set.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136758 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 036ac03..f1b126d 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -465,11 +465,6 @@
             }
         }
         
-        // Now see if we know the target triple, and if so, create our scratch AST context:
-        if (m_arch.IsValid())
-        {
-            m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
-        }
     }
 
     UpdateInstanceName();
@@ -911,6 +906,9 @@
 ClangASTContext *
 Target::GetScratchClangASTContext()
 {
+    // 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())
+        m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
     return m_scratch_ast_context_ap.get();
 }