[Lldb-commits] [lldb] a54ef8a - [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 28 05:07:13 PST 2019
Author: Raphael Isemann
Date: 2019-11-28T14:05:47+01:00
New Revision: a54ef8af89c78f7296bea6ffabb7728ef563bec1
URL: https://github.com/llvm/llvm-project/commit/a54ef8af89c78f7296bea6ffabb7728ef563bec1
DIFF: https://github.com/llvm/llvm-project/commit/a54ef8af89c78f7296bea6ffabb7728ef563bec1.diff
LOG: [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key
Added:
Modified:
lldb/source/Symbol/Symtab.cpp
Removed:
################################################################################
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 9a2b5cddd73b..c7a6bf214526 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -13,7 +13,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/RichManglingContext.h"
-#include "lldb/Core/STLUtils.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
@@ -107,10 +106,8 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder sort_order,
// sorted by name. So we must make the ordered symbol list up ourselves.
s->PutCString(" (sorted by name):\n");
DumpSymbolHeader(s);
- typedef std::multimap<const char *, const Symbol *,
- CStringCompareFunctionObject>
- CStringToSymbol;
- CStringToSymbol name_map;
+
+ std::multimap<llvm::StringRef, const Symbol *> name_map;
for (const_iterator pos = m_symbols.begin(), end = m_symbols.end();
pos != end; ++pos) {
const char *name = pos->GetName().AsCString();
@@ -118,12 +115,10 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder sort_order,
name_map.insert(std::make_pair(name, &(*pos)));
}
- for (CStringToSymbol::const_iterator pos = name_map.begin(),
- end = name_map.end();
- pos != end; ++pos) {
+ for (const auto &name_to_symbol : name_map) {
+ const Symbol *symbol = name_to_symbol.second;
s->Indent();
- pos->second->Dump(s, target, pos->second - &m_symbols[0],
- name_preference);
+ symbol->Dump(s, target, symbol - &m_symbols[0], name_preference);
}
} break;
More information about the lldb-commits
mailing list