[Lldb-commits] [lldb] f1a02c6 - [lldb] Fix unordered-map data formatter for const types (#156033)

via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 15 07:20:00 PDT 2025


Author: Ebuka Ezike
Date: 2025-09-15T15:19:55+01:00
New Revision: f1a02c681f0d092bb28ac3ff2e79eff11ecb95dc

URL: https://github.com/llvm/llvm-project/commit/f1a02c681f0d092bb28ac3ff2e79eff11ecb95dc
DIFF: https://github.com/llvm/llvm-project/commit/f1a02c681f0d092bb28ac3ff2e79eff11ecb95dc.diff

LOG: [lldb] Fix unordered-map data formatter for const types (#156033)

The test was failing because the const qualifier is not removed when checking if the type is an `unordered_map`

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index f88a5319068a2..4b183a8d62e53 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -113,10 +113,11 @@ 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()
-                         .GetNonReferenceType()
-                         .GetCanonicalType()
-                         .GetTypeName())) {
+  CompilerType backend_type = m_backend.GetCompilerType();
+  if (backend_type.IsPointerOrReferenceType())
+    backend_type = backend_type.GetPointeeType();
+
+  if (isUnorderedMap(backend_type.GetCanonicalType().GetTypeName())) {
     std::string name;
     CompilerType field_type =
         element_type.GetFieldAtIndex(0, name, nullptr, nullptr, nullptr);


        


More information about the lldb-commits mailing list