Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ static bool isUnorderedMap(ConstString type_name) {

CompilerType lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
GetElementType(CompilerType table_type) {
auto element_type = table_type.GetTypedefedType().GetTypeTemplateArgument(0);
auto element_type =
table_type.GetDirectNestedTypeWithName("value_type").GetTypedefedType();

// In newer unordered_map layouts, the std::pair element type isn't wrapped
// in any helper types. So return it directly.
if (isStdTemplate(element_type.GetTypeName(), "pair"))
return element_type;

// This synthetic provider is used for both unordered_(multi)map and
// unordered_(multi)set. For unordered_map, the element type has an
// additional type layer, an internal struct (`__hash_value_type`)
// that wraps a std::pair. Peel away the internal wrapper type - whose
// structure is of no value to users, to expose the std::pair. This
// matches the structure returned by the std::map synthetic provider.
// unordered_(multi)set. For older unordered_map layouts, the element type has
// an additional type layer, an internal struct (`__hash_value_type`) that
// wraps a std::pair. Peel away the internal wrapper type - whose structure is
// of no value to users, to expose the std::pair. This matches the structure
// returned by the std::map synthetic provider.
if (isUnorderedMap(
m_backend.GetCompilerType().GetCanonicalType().GetTypeName())) {
std::string name;
Expand Down
Loading