llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/197415.diff 1 Files Affected: - (modified) lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp (+27-27) ``````````diff diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp index ad163347b14ca..457cfa813bf6c 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -182,36 +182,36 @@ ObjCLanguageRuntime::GetISA(ConstString name) { ObjCLanguageRuntime::ISAToDescriptorIterator ObjCLanguageRuntime::GetDescriptorIterator(ConstString name) { - ISAToDescriptorIterator end = m_isa_to_descriptor.end(); + if (!name) + return m_isa_to_descriptor.end(); + + UpdateISAToDescriptorMap(); + + if (m_hash_to_isa_map.empty()) { + // No name hashes were provided, we need to just linearly power through + // the names and find a match + for (auto it = m_isa_to_descriptor.begin(), end = m_isa_to_descriptor.end(); + it != end; it++) + if (it->second->GetClassName() == name) + return it; + return m_isa_to_descriptor.end(); + } - if (name) { - UpdateISAToDescriptorMap(); - if (m_hash_to_isa_map.empty()) { - // No name hashes were provided, we need to just linearly power through - // the names and find a match - for (ISAToDescriptorIterator pos = m_isa_to_descriptor.begin(); - pos != end; ++pos) { - if (pos->second->GetClassName() == name) - return pos; - } - } else { - // Name hashes were provided, so use them to efficiently lookup name to - // isa/descriptor - 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; - ++range_pos) { - ISAToDescriptorIterator pos = - m_isa_to_descriptor.find(range_pos->second); - if (pos != m_isa_to_descriptor.end()) { - if (pos->second->GetClassName() == name) - return pos; - } - } + // Name hashes were provided, so use them to efficiently lookup name to + // isa/descriptor + 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; + ++range_pos) { + ISAToDescriptorIterator pos = m_isa_to_descriptor.find(range_pos->second); + if (pos != m_isa_to_descriptor.end()) { + if (pos->second->GetClassName() == name) + return pos; } } - return end; + + return m_isa_to_descriptor.end(); } std::pair<ObjCLanguageRuntime::ISAToDescriptorIterator, `````````` </details> https://github.com/llvm/llvm-project/pull/197415 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
