From f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:50:09 +0000 Subject: Vendor import of lldb release_39 branch r276489: https://llvm.org/svn/llvm-project/lldb/branches/release_39@276489 --- source/DataFormatters/FormatCache.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'source/DataFormatters/FormatCache.cpp') diff --git a/source/DataFormatters/FormatCache.cpp b/source/DataFormatters/FormatCache.cpp index 748c6d80fbd2..fc5becbf200d 100644 --- a/source/DataFormatters/FormatCache.cpp +++ b/source/DataFormatters/FormatCache.cpp @@ -158,11 +158,13 @@ FormatCache::Entry::SetValidator (lldb::TypeValidatorImplSP validator_sp) m_validator_sp = validator_sp; } -FormatCache::FormatCache () : -m_map(), -m_mutex (Mutex::eMutexTypeRecursive) +FormatCache::FormatCache() + : m_map(), + m_mutex() #ifdef LLDB_CONFIGURATION_DEBUG -,m_cache_hits(0),m_cache_misses(0) + , + m_cache_hits(0), + m_cache_misses(0) #endif { } @@ -181,9 +183,9 @@ FormatCache::GetEntry (const ConstString& type) bool FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); auto entry = GetEntry(type); - if (entry.IsSummaryCached()) + if (entry.IsFormatCached()) { #ifdef LLDB_CONFIGURATION_DEBUG m_cache_hits++; @@ -201,7 +203,7 @@ FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_s bool FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); auto entry = GetEntry(type); if (entry.IsSummaryCached()) { @@ -221,7 +223,7 @@ FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summar bool FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); auto entry = GetEntry(type); if (entry.IsSyntheticCached()) { @@ -241,7 +243,7 @@ FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& sy bool FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); auto entry = GetEntry(type); if (entry.IsValidatorCached()) { @@ -261,35 +263,35 @@ FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& va void FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); GetEntry(type).SetFormat(format_sp); } void FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); GetEntry(type).SetSummary(summary_sp); } void FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); GetEntry(type).SetSynthetic(synthetic_sp); } void FormatCache::SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp) { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); GetEntry(type).SetValidator(validator_sp); } void FormatCache::Clear () { - Mutex::Locker lock(m_mutex); + std::lock_guard guard(m_mutex); m_map.clear(); } -- cgit v1.2.3