From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- lldb/source/DataFormatters/FormatCache.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lldb/source/DataFormatters/FormatCache.cpp') diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp index 231e7ed0c0a0..5e0965fcdae4 100644 --- a/lldb/source/DataFormatters/FormatCache.cpp +++ b/lldb/source/DataFormatters/FormatCache.cpp @@ -1,5 +1,4 @@ -//===-- FormatCache.cpp ------------------------------------------*- C++ -//-*-===// +//===-- FormatCache.cpp ---------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -52,15 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP synthetic_sp) { m_synthetic_sp = synthetic_sp; } -FormatCache::FormatCache() - : m_map(), m_mutex() -#ifdef LLDB_CONFIGURATION_DEBUG - , - m_cache_hits(0), m_cache_misses(0) -#endif -{ -} - FormatCache::Entry &FormatCache::GetEntry(ConstString type) { auto i = m_map.find(type), e = m_map.end(); if (i != e) @@ -69,6 +59,8 @@ FormatCache::Entry &FormatCache::GetEntry(ConstString type) { return m_map[type]; } +namespace lldb_private { + template<> bool FormatCache::Entry::IsCached() { return IsFormatCached(); } @@ -79,20 +71,18 @@ template<> bool FormatCache::Entry::IsCached() { return IsSyntheticCached(); } +} // namespace lldb_private + template bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) { std::lock_guard guard(m_mutex); auto entry = GetEntry(type); if (entry.IsCached()) { -#ifdef LLDB_CONFIGURATION_DEBUG m_cache_hits++; -#endif entry.Get(format_impl_sp); return true; } -#ifdef LLDB_CONFIGURATION_DEBUG m_cache_misses++; -#endif format_impl_sp.reset(); return false; } -- cgit v1.2.3