diff --git a/lldb/include/lldb/Target/ProcessStructReader.h b/lldb/include/lldb/Target/ProcessStructReader.h --- a/lldb/include/lldb/Target/ProcessStructReader.h +++ b/lldb/include/lldb/Target/ProcessStructReader.h @@ -14,11 +14,12 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Status.h" +#include "llvm/ADT/StringMap.h" + #include #include #include @@ -32,7 +33,7 @@ size_t size; }; - std::map m_fields; + llvm::StringMap m_fields; DataExtractor m_data; lldb::ByteOrder m_byte_order; size_t m_addr_byte_size; @@ -62,10 +63,9 @@ // no support for things larger than a uint64_t (yet) if (!size || *size > 8) return; - ConstString const_name = ConstString(name.c_str()); size_t byte_index = static_cast(bit_offset / 8); - m_fields[const_name] = - FieldImpl{field_type, byte_index, static_cast(*size)}; + m_fields.insert({name, FieldImpl{field_type, byte_index, + static_cast(*size)}}); } auto total_size = struct_type.GetByteSize(nullptr); if (!total_size) @@ -80,7 +80,7 @@ } template - RetType GetField(ConstString name, RetType fail_value = RetType()) { + RetType GetField(llvm::StringRef name, RetType fail_value = RetType()) { auto iter = m_fields.find(name), end = m_fields.end(); if (iter == end) return fail_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -442,13 +442,13 @@ dispatch_tsd_indexes_s); m_libdispatch_tsd_indexes.dti_version = - struct_reader.GetField(ConstString("dti_version")); + struct_reader.GetField("dti_version"); m_libdispatch_tsd_indexes.dti_queue_index = - struct_reader.GetField(ConstString("dti_queue_index")); + struct_reader.GetField("dti_queue_index"); m_libdispatch_tsd_indexes.dti_voucher_index = - struct_reader.GetField(ConstString("dti_voucher_index")); + struct_reader.GetField("dti_voucher_index"); m_libdispatch_tsd_indexes.dti_qos_class_index = - struct_reader.GetField(ConstString("dti_qos_class_index")); + struct_reader.GetField("dti_qos_class_index"); } } }