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
This commit is contained in:
Adrian Prantl
2019-03-06 21:22:25 +00:00
parent 480bce28ff
commit 0e4c482124
209 changed files with 824 additions and 825 deletions

View File

@@ -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);
}