[lldb][DataFormatter] Unwrap reference type when formatting std::unordered_map (#145872)
Desugar any potential references/typedefs before checking `isStdTemplate`. Previously, the typename might've been: ``` const std::unordered_map<...> & ``` for references. This patch gets the pointee type before grabbing the canonical type. `GetNonReferenceType` will unwrap typedefs too, so we should always end up with a non-reference before we get to `GetCanonicalType`. https://github.com/llvm/llvm-project/issues/145847
This commit is contained in:
@@ -113,8 +113,10 @@ CompilerType lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
|
||||
// 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())) {
|
||||
if (isUnorderedMap(m_backend.GetCompilerType()
|
||||
.GetNonReferenceType()
|
||||
.GetCanonicalType()
|
||||
.GetTypeName())) {
|
||||
std::string name;
|
||||
CompilerType field_type =
|
||||
element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user