diff options
author | Pavel Labath <labath@google.com> | 2017-05-02 10:17:30 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-05-02 10:17:30 +0000 |
commit | 4d35d6b3b38bba179c26049c86e3cb8a05559154 (patch) | |
tree | 586e8430edf70f49f01a414c93c2c88c5a323f8c /lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp | |
parent | 8deb87a6c06b466e62bd58e09b86309ef6153ddb (diff) | |
download | bcm5719-llvm-4d35d6b3b38bba179c26049c86e3cb8a05559154.tar.gz bcm5719-llvm-4d35d6b3b38bba179c26049c86e3cb8a05559154.zip |
Change UniqueCStringMap to use ConstString as the key
Summary:
UniqueCStringMap "sorts" the entries for fast lookup, but really it only cares about uniqueness. ConstString can be compared by pointer alone, rather than with strcmp, resulting in much faster comparisons. Change the interface to take ConstString instead, and propagate use of the type to the callers where appropriate.
Reviewers: #lldb, clayborg
Reviewed By: clayborg
Subscribers: labath, jasonmolenda, lldb-commits
Differential Revision: https://reviews.llvm.org/D32316
Patch by Scott Smith <scott.smith@purestorage.com>.
llvm-svn: 301908
Diffstat (limited to 'lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index b74da330017..92815751680 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -158,7 +158,7 @@ size_t ObjectContainerBSDArchive::Archive::ParseObjects() { size_t obj_idx = m_objects.size(); m_objects.push_back(obj); // Insert all of the C strings out of order for now... - m_object_name_to_index_map.Append(obj.ar_name.GetStringRef(), obj_idx); + m_object_name_to_index_map.Append(obj.ar_name, obj_idx); offset += obj.ar_file_size; obj.Clear(); } while (data.ValidOffset(offset)); @@ -174,8 +174,7 @@ ObjectContainerBSDArchive::Archive::FindObject( const ConstString &object_name, const llvm::sys::TimePoint<> &object_mod_time) { const ObjectNameToIndexMap::Entry *match = - m_object_name_to_index_map.FindFirstValueForName( - object_name.GetStringRef()); + m_object_name_to_index_map.FindFirstValueForName(object_name); if (match) { if (object_mod_time != llvm::sys::TimePoint<>()) { const uint64_t object_date = llvm::sys::toTimeT(object_mod_time); |