summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp4
-rw-r--r--lldb/source/Target/Target.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index db08539b977..ca97fc19d34 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -27,7 +27,9 @@ ClangASTSource::~ClangASTSource()
{
m_ast_importer->ForgetDestination(m_ast_context);
- ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();
+ // 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);
if (!scratch_clang_ast_context)
return;
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 53e8ccfdac6..978ab5ec4d5 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1335,10 +1335,10 @@ Target::ImageSearchPathsChanged
}
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()));
OpenPOWER on IntegriCloud