From 0e4c482124f098957fc13bcfbabc36775dd190ab Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 6 Mar 2019 21:22:25 +0000 Subject: Pass ConstString by value (NFC) My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553 --- lldb/source/DataFormatters/FormatCache.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lldb/source/DataFormatters/FormatCache.cpp') diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp index c05b116b6acb..7e328cb0dac8 100644 --- a/lldb/source/DataFormatters/FormatCache.cpp +++ b/lldb/source/DataFormatters/FormatCache.cpp @@ -109,7 +109,7 @@ FormatCache::FormatCache() { } -FormatCache::Entry &FormatCache::GetEntry(const ConstString &type) { +FormatCache::Entry &FormatCache::GetEntry(ConstString type) { auto i = m_map.find(type), e = m_map.end(); if (i != e) return i->second; @@ -117,7 +117,7 @@ FormatCache::Entry &FormatCache::GetEntry(const ConstString &type) { return m_map[type]; } -bool FormatCache::GetFormat(const ConstString &type, +bool FormatCache::GetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp) { std::lock_guard guard(m_mutex); auto entry = GetEntry(type); @@ -135,7 +135,7 @@ bool FormatCache::GetFormat(const ConstString &type, return false; } -bool FormatCache::GetSummary(const ConstString &type, +bool FormatCache::GetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp) { std::lock_guard guard(m_mutex); auto entry = GetEntry(type); @@ -153,7 +153,7 @@ bool FormatCache::GetSummary(const ConstString &type, return false; } -bool FormatCache::GetSynthetic(const ConstString &type, +bool FormatCache::GetSynthetic(ConstString type, lldb::SyntheticChildrenSP &synthetic_sp) { std::lock_guard guard(m_mutex); auto entry = GetEntry(type); @@ -171,7 +171,7 @@ bool FormatCache::GetSynthetic(const ConstString &type, return false; } -bool FormatCache::GetValidator(const ConstString &type, +bool FormatCache::GetValidator(ConstString type, lldb::TypeValidatorImplSP &validator_sp) { std::lock_guard guard(m_mutex); auto entry = GetEntry(type); @@ -189,25 +189,25 @@ bool FormatCache::GetValidator(const ConstString &type, return false; } -void FormatCache::SetFormat(const ConstString &type, +void FormatCache::SetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp) { std::lock_guard guard(m_mutex); GetEntry(type).SetFormat(format_sp); } -void FormatCache::SetSummary(const ConstString &type, +void FormatCache::SetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp) { std::lock_guard guard(m_mutex); GetEntry(type).SetSummary(summary_sp); } -void FormatCache::SetSynthetic(const ConstString &type, +void FormatCache::SetSynthetic(ConstString type, lldb::SyntheticChildrenSP &synthetic_sp) { std::lock_guard guard(m_mutex); GetEntry(type).SetSynthetic(synthetic_sp); } -void FormatCache::SetValidator(const ConstString &type, +void FormatCache::SetValidator(ConstString type, lldb::TypeValidatorImplSP &validator_sp) { std::lock_guard guard(m_mutex); GetEntry(type).SetValidator(validator_sp); -- cgit v1.2.3