[Lldb-commits] [lldb] r145537 - in /lldb/trunk: include/lldb/Target/Target.h source/Expression/ClangASTSource.cpp source/Target/Target.cpp test/functionalities/load_unload/TestLoadUnload.py
Johnny Chen
johnny.chen at apple.com
Wed Nov 30 15:18:54 PST 2011
Author: johnny
Date: Wed Nov 30 17:18:53 2011
New Revision: 145537
URL: http://llvm.org/viewvc/llvm-project?rev=145537&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=145537&r1=145536&r2=145537&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed Nov 30 17:18:53 2011
@@ -799,7 +799,7 @@
GetImageSearchPathList ();
ClangASTContext *
- GetScratchClangASTContext();
+ GetScratchClangASTContext(bool create_on_demand=true);
ClangASTImporter *
GetClangASTImporter();
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=145537&r1=145536&r2=145537&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Nov 30 17:18:53 2011
@@ -27,7 +27,9 @@
{
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;
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=145537&r1=145536&r2=145537&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Nov 30 17:18:53 2011
@@ -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()));
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=145537&r1=145536&r2=145537&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Wed Nov 30 17:18:53 2011
@@ -49,7 +49,7 @@
# Add teardown hook to clear image-search-paths after the test.
# rdar://problem/10501020
# Uncomment the following to reproduce 10501020.
- #self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))
+ self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))
self.expect("target modules search-paths list",
substrs = [os.getcwd(), new_dir])
More information about the lldb-commits
mailing list