Modified all logging calls to hand out shared pointers to make sure we

don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.

llvm-svn: 118319
This commit is contained in:
Greg Clayton
2010-11-06 01:53:30 +00:00
parent 8e3d95e7df
commit 2d4edfbc6a
98 changed files with 586 additions and 565 deletions

View File

@@ -25,7 +25,7 @@ SBFileSpec::SBFileSpec () :
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
m_opaque_ap()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (rhs.m_opaque_ap.get())
m_opaque_ap.reset (new FileSpec (rhs.get()));
@@ -48,7 +48,7 @@ SBFileSpec::SBFileSpec (const char *path) :
SBFileSpec::SBFileSpec (const char *path, bool resolve) :
m_opaque_ap(new FileSpec (path, resolve))
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path,
@@ -79,7 +79,7 @@ SBFileSpec::IsValid() const
bool
SBFileSpec::Exists () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque_ap.get())
@@ -112,7 +112,7 @@ SBFileSpec::GetFilename() const
if (m_opaque_ap.get())
s = m_opaque_ap->GetFilename().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (s)
@@ -130,7 +130,7 @@ SBFileSpec::GetDirectory() const
const char *s = NULL;
if (m_opaque_ap.get())
s = m_opaque_ap->GetDirectory().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (s)
@@ -144,7 +144,7 @@ SBFileSpec::GetDirectory() const
uint32_t
SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t result = 0;
if (m_opaque_ap.get())