diff options
author | emaste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
commit | c727fe695d28799acb499e9961f11ec07d4f9fe2 (patch) | |
tree | 56d79f94966870db1cecd65a7264510a25fd1cba /source/DataFormatters/FormatCache.cpp | |
parent | 2e8c9206a971efee1b77ad2ae852265d6f4ecaa0 (diff) | |
download | FreeBSD-src-c727fe695d28799acb499e9961f11ec07d4f9fe2.zip FreeBSD-src-c727fe695d28799acb499e9961f11ec07d4f9fe2.tar.gz |
Import lldb as of SVN r194122
Sponsored by: DARPA, AFRL
Diffstat (limited to 'source/DataFormatters/FormatCache.cpp')
-rw-r--r-- | source/DataFormatters/FormatCache.cpp | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/source/DataFormatters/FormatCache.cpp b/source/DataFormatters/FormatCache.cpp index af7b1c3..3721f18 100644 --- a/source/DataFormatters/FormatCache.cpp +++ b/source/DataFormatters/FormatCache.cpp @@ -22,33 +22,55 @@ using namespace lldb; using namespace lldb_private; FormatCache::Entry::Entry () : +m_format_cached(false), m_summary_cached(false), m_synthetic_cached(false), +m_format_sp(), m_summary_sp(), m_synthetic_sp() {} +FormatCache::Entry::Entry (lldb::TypeFormatImplSP format_sp) : +m_summary_cached(false), +m_synthetic_cached(false), +m_summary_sp(), +m_synthetic_sp() +{ + SetFormat (format_sp); +} + FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp) : +m_format_cached(false), m_synthetic_cached(false), +m_format_sp(), m_synthetic_sp() { SetSummary (summary_sp); } FormatCache::Entry::Entry (lldb::SyntheticChildrenSP synthetic_sp) : +m_format_cached(false), m_summary_cached(false), +m_format_sp(), m_summary_sp() { SetSynthetic (synthetic_sp); } -FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp,lldb::SyntheticChildrenSP synthetic_sp) +FormatCache::Entry::Entry (lldb::TypeFormatImplSP format_sp, lldb::TypeSummaryImplSP summary_sp, lldb::SyntheticChildrenSP synthetic_sp) { + SetFormat (format_sp); SetSummary (summary_sp); SetSynthetic (synthetic_sp); } bool +FormatCache::Entry::IsFormatCached () +{ + return m_format_cached; +} + +bool FormatCache::Entry::IsSummaryCached () { return m_summary_cached; @@ -60,6 +82,12 @@ FormatCache::Entry::IsSyntheticCached () return m_synthetic_cached; } +lldb::TypeFormatImplSP +FormatCache::Entry::GetFormat () +{ + return m_format_sp; +} + lldb::TypeSummaryImplSP FormatCache::Entry::GetSummary () { @@ -73,6 +101,13 @@ FormatCache::Entry::GetSynthetic () } void +FormatCache::Entry::SetFormat (lldb::TypeFormatImplSP format_sp) +{ + m_format_cached = true; + m_format_sp = format_sp; +} + +void FormatCache::Entry::SetSummary (lldb::TypeSummaryImplSP summary_sp) { m_summary_cached = true; @@ -107,6 +142,26 @@ FormatCache::GetEntry (const ConstString& type) } bool +FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp) +{ + Mutex::Locker lock(m_mutex); + auto entry = GetEntry(type); + if (entry.IsSummaryCached()) + { +#ifdef LLDB_CONFIGURATION_DEBUG + m_cache_hits++; +#endif + format_sp = entry.GetFormat(); + return true; + } +#ifdef LLDB_CONFIGURATION_DEBUG + m_cache_misses++; +#endif + format_sp.reset(); + return false; +} + +bool FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp) { Mutex::Locker lock(m_mutex); @@ -147,6 +202,13 @@ FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& sy } void +FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp) +{ + Mutex::Locker lock(m_mutex); + GetEntry(type).SetFormat(format_sp); +} + +void FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp) { Mutex::Locker lock(m_mutex); |