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

@@ -194,7 +194,7 @@ protected:
continue;
// Print a new header if the module changed.
const ConstString &module_file_name =
ConstString module_file_name =
module->GetFileSpec().GetFilename();
assert(module_file_name);
if (module_file_name != last_module_file_name) {
@@ -240,8 +240,8 @@ protected:
// Dump all matching lines at or above start_line for the file in the
// CU.
const ConstString &file_spec_name = file_spec.GetFilename();
const ConstString &module_file_name =
ConstString file_spec_name = file_spec.GetFilename();
ConstString module_file_name =
module->GetFileSpec().GetFilename();
bool cu_header_printed = false;
uint32_t line = start_line;
@@ -780,7 +780,7 @@ protected:
ConstString function;
LineEntry line_entry;
SourceInfo(const ConstString &name, const LineEntry &line_entry)
SourceInfo(ConstString name, const LineEntry &line_entry)
: function(name), line_entry(line_entry) {}
SourceInfo() : function(), line_entry() {}
@@ -901,7 +901,7 @@ protected:
// these somewhere, there should probably be a module-filter-list that can be
// passed to the various ModuleList::Find* calls, which would either be a
// vector of string names or a ModuleSpecList.
size_t FindMatchingFunctions(Target *target, const ConstString &name,
size_t FindMatchingFunctions(Target *target, ConstString name,
SymbolContextList &sc_list) {
// Displaying the source for a symbol:
bool include_inlines = true;
@@ -934,7 +934,7 @@ protected:
return num_matches;
}
size_t FindMatchingFunctionSymbols(Target *target, const ConstString &name,
size_t FindMatchingFunctionSymbols(Target *target, ConstString name,
SymbolContextList &sc_list) {
size_t num_matches = 0;
const size_t num_modules = m_options.modules.size();