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/DataVisualization.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lldb/source/DataFormatters/DataVisualization.cpp') diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp index 7ec3a9381d91..300ce2a08ba1 100644 --- a/lldb/source/DataFormatters/DataVisualization.cpp +++ b/lldb/source/DataFormatters/DataVisualization.cpp @@ -96,7 +96,7 @@ bool DataVisualization::AnyMatches( matching_category, matching_type); } -bool DataVisualization::Categories::GetCategory(const ConstString &category, +bool DataVisualization::Categories::GetCategory(ConstString category, lldb::TypeCategoryImplSP &entry, bool allow_create) { entry = GetFormatManager().GetCategory(category, allow_create); @@ -111,11 +111,11 @@ bool DataVisualization::Categories::GetCategory( return (entry.get() != nullptr); } -void DataVisualization::Categories::Add(const ConstString &category) { +void DataVisualization::Categories::Add(ConstString category) { GetFormatManager().GetCategory(category); } -bool DataVisualization::Categories::Delete(const ConstString &category) { +bool DataVisualization::Categories::Delete(ConstString category) { GetFormatManager().DisableCategory(category); return GetFormatManager().DeleteCategory(category); } @@ -124,12 +124,12 @@ void DataVisualization::Categories::Clear() { GetFormatManager().ClearCategories(); } -void DataVisualization::Categories::Clear(const ConstString &category) { +void DataVisualization::Categories::Clear(ConstString category) { GetFormatManager().GetCategory(category)->Clear( eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary); } -void DataVisualization::Categories::Enable(const ConstString &category, +void DataVisualization::Categories::Enable(ConstString category, TypeCategoryMap::Position pos) { if (GetFormatManager().GetCategory(category)->IsEnabled()) GetFormatManager().DisableCategory(category); @@ -143,7 +143,7 @@ void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) { lang_category->Enable(); } -void DataVisualization::Categories::Disable(const ConstString &category) { +void DataVisualization::Categories::Disable(ConstString category) { if (GetFormatManager().GetCategory(category)->IsEnabled()) GetFormatManager().DisableCategory(category); } @@ -192,17 +192,17 @@ DataVisualization::Categories::GetCategoryAtIndex(size_t index) { } bool DataVisualization::NamedSummaryFormats::GetSummaryFormat( - const ConstString &type, lldb::TypeSummaryImplSP &entry) { + ConstString type, lldb::TypeSummaryImplSP &entry) { return GetFormatManager().GetNamedSummaryContainer().Get(type, entry); } void DataVisualization::NamedSummaryFormats::Add( - const ConstString &type, const lldb::TypeSummaryImplSP &entry) { + ConstString type, const lldb::TypeSummaryImplSP &entry) { GetFormatManager().GetNamedSummaryContainer().Add( FormatManager::GetValidTypeName(type), entry); } -bool DataVisualization::NamedSummaryFormats::Delete(const ConstString &type) { +bool DataVisualization::NamedSummaryFormats::Delete(ConstString type) { return GetFormatManager().GetNamedSummaryContainer().Delete(type); } -- cgit v1.2.3