[Lldb-commits] [lldb] r166132 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Symbol/ClangASTContext.cpp
Sean Callanan
scallanan at apple.com
Wed Oct 17 15:11:14 PDT 2012
Author: spyffe
Date: Wed Oct 17 17:11:14 2012
New Revision: 166132
URL: http://llvm.org/viewvc/llvm-project?rev=166132&view=rev
Log:
Fixed ClangASTContext to own its TargetOptions
using a reference-counted pointer. This avoids
memory-management problems when the TargetOptions
are deleted.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=166132&r1=166131&r2=166132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Wed Oct 17 17:11:14 2012
@@ -977,7 +977,7 @@
std::auto_ptr<clang::SourceManager> m_source_manager_ap;
std::auto_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_ap;
std::auto_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_ap;
- std::auto_ptr<clang::TargetOptions> m_target_options_ap;
+ llvm::IntrusiveRefCntPtr<clang::TargetOptions> m_target_options_rp;
std::auto_ptr<clang::TargetInfo> m_target_info_ap;
std::auto_ptr<clang::IdentifierTable> m_identifier_table_ap;
std::auto_ptr<clang::SelectorTable> m_selector_table_ap;
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=166132&r1=166131&r2=166132&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Oct 17 17:11:14 2012
@@ -379,7 +379,7 @@
m_language_options_ap(),
m_source_manager_ap(),
m_diagnostics_engine_ap(),
- m_target_options_ap(),
+ m_target_options_rp(),
m_target_info_ap(),
m_identifier_table_ap(),
m_selector_table_ap(),
@@ -402,7 +402,7 @@
m_selector_table_ap.reset();
m_identifier_table_ap.reset();
m_target_info_ap.reset();
- m_target_options_ap.reset();
+ m_target_options_rp.reset();
m_diagnostics_engine_ap.reset();
m_source_manager_ap.reset();
m_language_options_ap.reset();
@@ -417,7 +417,7 @@
m_language_options_ap.reset();
m_source_manager_ap.reset();
m_diagnostics_engine_ap.reset();
- m_target_options_ap.reset();
+ m_target_options_rp.reset();
m_target_info_ap.reset();
m_identifier_table_ap.reset();
m_selector_table_ap.reset();
@@ -609,13 +609,14 @@
TargetOptions *
ClangASTContext::getTargetOptions()
{
- if (m_target_options_ap.get() == NULL && !m_target_triple.empty())
+ if (m_target_options_rp.getPtr() == NULL && !m_target_triple.empty())
{
- m_target_options_ap.reset (new TargetOptions());
- if (m_target_options_ap.get())
- m_target_options_ap->Triple = m_target_triple;
+ m_target_options_rp.reset ();
+ m_target_options_rp = new TargetOptions();
+ if (m_target_options_rp.getPtr() != NULL)
+ m_target_options_rp->Triple = m_target_triple;
}
- return m_target_options_ap.get();
+ return m_target_options_rp.getPtr();
}
More information about the lldb-commits
mailing list