llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/80603.diff 2 Files Affected: - (modified) lldb/include/lldb/DataFormatters/FormatCache.h (+1-4) - (modified) lldb/source/DataFormatters/FormatCache.cpp (+5-13) ``````````diff diff --git a/lldb/include/lldb/DataFormatters/FormatCache.h b/lldb/include/lldb/DataFormatters/FormatCache.h index e75aaee1a7bb8..3f1baa26a5a54 100644 --- a/lldb/include/lldb/DataFormatters/FormatCache.h +++ b/lldb/include/lldb/DataFormatters/FormatCache.h @@ -45,15 +45,12 @@ class FormatCache { void Set(lldb::TypeSummaryImplSP); void Set(lldb::SyntheticChildrenSP); }; - typedef std::map<ConstString, Entry> CacheMap; - CacheMap m_map; + std::map<ConstString, Entry> m_entries; std::recursive_mutex m_mutex; uint64_t m_cache_hits = 0; uint64_t m_cache_misses = 0; - Entry &GetEntry(ConstString type); - public: FormatCache() = default; diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp index 5e0965fcdae40..6c83b36e79dea 100644 --- a/lldb/source/DataFormatters/FormatCache.cpp +++ b/lldb/source/DataFormatters/FormatCache.cpp @@ -51,14 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP synthetic_sp) { m_synthetic_sp = synthetic_sp; } -FormatCache::Entry &FormatCache::GetEntry(ConstString type) { - auto i = m_map.find(type), e = m_map.end(); - if (i != e) - return i->second; - m_map[type] = FormatCache::Entry(); - return m_map[type]; -} - namespace lldb_private { template<> bool FormatCache::Entry::IsCached<lldb::TypeFormatImplSP>() { @@ -76,7 +68,7 @@ template<> bool FormatCache::Entry::IsCached<lldb::SyntheticChildrenSP>() { template <typename ImplSP> bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - auto entry = GetEntry(type); + auto entry = m_entries[type]; if (entry.IsCached<ImplSP>()) { m_cache_hits++; entry.Get(format_impl_sp); @@ -101,21 +93,21 @@ FormatCache::Get<lldb::SyntheticChildrenSP>(ConstString, void FormatCache::Set(ConstString type, lldb::TypeFormatImplSP &format_sp) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - GetEntry(type).Set(format_sp); + m_entries[type].Set(format_sp); } void FormatCache::Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - GetEntry(type).Set(summary_sp); + m_entries[type].Set(summary_sp); } void FormatCache::Set(ConstString type, lldb::SyntheticChildrenSP &synthetic_sp) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - GetEntry(type).Set(synthetic_sp); + m_entries[type].Set(synthetic_sp); } void FormatCache::Clear() { std::lock_guard<std::recursive_mutex> guard(m_mutex); - m_map.clear(); + m_entries.clear(); } `````````` </details> https://github.com/llvm/llvm-project/pull/80603 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits