diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-10-09 16:22:14 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-10-09 16:22:14 +0000 |
commit | 939411c1aaa8830de2273849d5b8417788a25f67 (patch) | |
tree | 4f2f34e5fd46e9e01298286eae4897b53656c501 /lldb/source/Plugins/ObjectFile | |
parent | 6453f700f29a93ceb17ac43d6e8b802f9898fa6a (diff) | |
download | bcm5719-llvm-939411c1aaa8830de2273849d5b8417788a25f67.tar.gz bcm5719-llvm-939411c1aaa8830de2273849d5b8417788a25f67.zip |
Remove the is_mangled flag from Mangled and Symbol
Testing whether a name is mangled or not is extremely cheap and can be
done by looking at the first two characters. Mangled knows how to do
it. On the flip side, many call sites that currently pass in an
is_mangled determination do not know how to correctly do it (for
example, they leave out Swift mangling prefixes).
This patch removes this entry point and just forced Mangled to
determine the mangledness of a string itself.
Differential Revision: https://reviews.llvm.org/D68674
llvm-svn: 374180
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index a52f774e4e1..d773832a975 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2209,8 +2209,6 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, bool is_global = symbol.getBinding() == STB_GLOBAL; uint32_t flags = symbol.st_other << 8 | symbol.st_info | additional_flags; - bool is_mangled = (symbol_name[0] == '_' && symbol_name[1] == 'Z'); - llvm::StringRef symbol_ref(symbol_name); // Symbol names may contain @VERSION suffixes. Find those and strip them @@ -2218,7 +2216,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, size_t version_pos = symbol_ref.find('@'); bool has_suffix = version_pos != llvm::StringRef::npos; llvm::StringRef symbol_bare = symbol_ref.substr(0, version_pos); - Mangled mangled(ConstString(symbol_bare), is_mangled); + Mangled mangled(symbol_bare); // Now append the suffix back to mangled and unmangled names. Only do it if // the demangling was successful (string is not empty). @@ -2449,14 +2447,11 @@ static unsigned ParsePLTRelocations( break; const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); - bool is_mangled = - symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false; uint64_t plt_index = plt_offset + i * plt_entsize; Symbol jump_symbol( i + start_id, // Symbol table index symbol_name, // symbol name. - is_mangled, // is the symbol name mangled? eSymbolTypeTrampoline, // Type of this symbol false, // Is this globally visible? false, // Is this symbol debug info? @@ -2899,7 +2894,6 @@ void ObjectFileELF::ParseUnwindSymbols(Symtab *symbol_table, Symbol eh_symbol( symbol_id, // Symbol table index. symbol_name, // Symbol name. - false, // Is the symbol name mangled? eSymbolTypeCode, // Type of this symbol. true, // Is this globally visible? false, // Is this symbol debug info? |