diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-03-06 21:22:25 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-03-06 21:22:25 +0000 |
commit | 0e4c482124f098957fc13bcfbabc36775dd190ab (patch) | |
tree | 34ee130b6d6de0d41a229021c4b46ab66b891a08 /lldb/source/DataFormatters/DataVisualization.cpp | |
parent | 480bce28ffc4640f443e262fa110af50b0d635df (diff) | |
download | bcm5719-llvm-0e4c482124f098957fc13bcfbabc36775dd190ab.tar.gz bcm5719-llvm-0e4c482124f098957fc13bcfbabc36775dd190ab.zip |
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
Diffstat (limited to 'lldb/source/DataFormatters/DataVisualization.cpp')
-rw-r--r-- | lldb/source/DataFormatters/DataVisualization.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp index 7ec3a9381d9..300ce2a08ba 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); } |