From 0b90d09898cadc89105c3caf0d01f09e66c49993 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Wed, 14 Jun 2023 15:15:40 -0700 Subject: [PATCH] [lldb][NFCI] Remove use of ConstString in ProcessStructReader std::map is naturally replaced with `llvm::StringMap` here. Differential Revision: https://reviews.llvm.org/D152968 --- lldb/include/lldb/Target/ProcessStructReader.h | 12 ++++++------ .../Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lldb/include/lldb/Target/ProcessStructReader.h b/lldb/include/lldb/Target/ProcessStructReader.h index ceb7052..0f0b3f6 100644 --- 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 @@ protected: 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 @@ public: // 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 @@ public: } 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 index ae5e1b7..f4ddc9e 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -442,13 +442,13 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes() { 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"); } } } -- 2.7.4