diff options
author | Pavel Labath <labath@google.com> | 2018-02-23 17:49:26 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-02-23 17:49:26 +0000 |
commit | b39fca958d70c9682aaa8b87f58aa88449582cc8 (patch) | |
tree | 70fff2b94ecbd7fc0b072b24cc4a234a3eec3186 /lldb/source/Target/ObjCLanguageRuntime.cpp | |
parent | 523c656e254769c455c5519739cf097dcd2260c7 (diff) | |
download | bcm5719-llvm-b39fca958d70c9682aaa8b87f58aa88449582cc8.tar.gz bcm5719-llvm-b39fca958d70c9682aaa8b87f58aa88449582cc8.zip |
Replace HashStringUsingDJB with llvm::djbHash
Summary:
The llvm function is equivalent to this one. Where possible I tried to
replace const char* with llvm::StringRef to avoid extra strlen
computations. In most places, I was able to track the c string back to
the ConstString it was created from.
I also create a test that verifies we are able to lookup names with
unicode characters, as a bug in the llvm compiler (it accidentally used
a different hash function) meant this was not working until recently.
This also removes the unused ExportTable class.
Reviewers: aprantl, davide
Subscribers: JDevlieghere, lldb-commits
Differential Revision: https://reviews.llvm.org/D43596
llvm-svn: 325927
Diffstat (limited to 'lldb/source/Target/ObjCLanguageRuntime.cpp')
-rw-r--r-- | lldb/source/Target/ObjCLanguageRuntime.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index d3cc7c019dc..e50167dcb58 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -23,6 +23,7 @@ #include "lldb/Utility/Timer.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/DJB.h" using namespace lldb; using namespace lldb_private; @@ -45,8 +46,7 @@ bool ObjCLanguageRuntime::AddClass(ObjCISA isa, if (isa != 0) { m_isa_to_descriptor[isa] = descriptor_sp; // class_name is assumed to be valid - m_hash_to_isa_map.insert( - std::make_pair(MappedHash::HashStringUsingDJB(class_name), isa)); + m_hash_to_isa_map.insert(std::make_pair(llvm::djbHash(class_name), isa)); return true; } return false; @@ -180,8 +180,7 @@ ObjCLanguageRuntime::GetDescriptorIterator(const ConstString &name) { } else { // Name hashes were provided, so use them to efficiently lookup name to // isa/descriptor - const uint32_t name_hash = - MappedHash::HashStringUsingDJB(name.GetCString()); + const uint32_t name_hash = llvm::djbHash(name.GetStringRef()); std::pair<HashToISAIterator, HashToISAIterator> range = m_hash_to_isa_map.equal_range(name_hash); for (HashToISAIterator range_pos = range.first; range_pos != range.second; |