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/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp') diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 7ea60303e1b..ca2da5a72a5 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2176,7 +2176,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, if (symbol_type == eSymbolTypeInvalid && symbol.getType() != STT_SECTION) { if (symbol_section_sp) { - const ConstString §_name = symbol_section_sp->GetName(); + ConstString sect_name = symbol_section_sp->GetName(); if (sect_name == text_section_name || sect_name == init_section_name || sect_name == fini_section_name || sect_name == ctors_section_name || sect_name == dtors_section_name) { @@ -2320,7 +2320,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, if (symbol_section_sp && module_section_list && module_section_list != section_list) { - const ConstString §_name = symbol_section_sp->GetName(); + ConstString sect_name = symbol_section_sp->GetName(); auto section_it = section_name_to_section.find(sect_name.GetCString()); if (section_it == section_name_to_section.end()) section_it = -- cgit v1.2.3