Skip to content

Commit 09ad3b0

Browse files
committed
[lldb] fix std::unordered_map formatter for const types.
the type that is checked in isUnordered may be const qualified.
1 parent 54fc536 commit 09ad3b0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ CompilerType lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
113113
// wraps a std::pair. Peel away the internal wrapper type - whose structure is
114114
// of no value to users, to expose the std::pair. This matches the structure
115115
// returned by the std::map synthetic provider.
116-
if (isUnorderedMap(m_backend.GetCompilerType()
117-
.GetNonReferenceType()
118-
.GetCanonicalType()
119-
.GetTypeName())) {
116+
CompilerType backend_type = m_backend.GetCompilerType();
117+
if (backend_type.IsPointerOrReferenceType())
118+
backend_type = backend_type.GetPointeeType();
119+
120+
if (isUnorderedMap(backend_type.GetCanonicalType().GetTypeName())) {
120121
std::string name;
121122
CompilerType field_type =
122123
element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
@@ -165,9 +166,9 @@ lldb::ValueObjectSP lldb_private::formatters::
165166
ValueObjectSP hash_sp = node_sp->GetChildMemberWithName("__hash_");
166167
if (!hash_sp || !value_sp) {
167168
node_sp = m_next_element->Cast(m_node_type.GetPointerType())
168-
->Dereference(error);
169+
->Dereference(error);
169170
if (!node_sp || error.Fail())
170-
return nullptr;
171+
return nullptr;
171172

172173
hash_sp = node_sp->GetChildMemberWithName("__hash_");
173174
if (!hash_sp)

0 commit comments

Comments
 (0)