Create the scratch AST context in the accessor function, not
only when the executable is set.
llvm-svn: 136758
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 036ac03..f1b126d 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/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();
}