[Lldb-commits] [lldb] 98aa840 - [lldb][Formatters] Simplify std::list libc++ formatter matching regex (#147709)

via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 11 09:25:59 PST 2025


Author: Michael Buch
Date: 2025-12-11T17:25:56Z
New Revision: 98aa84075d3d2eeea4296d1e1a69c23db70edab2

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

LOG: [lldb][Formatters] Simplify std::list libc++ formatter matching regex (#147709)

The history on this is a bit confusing. The libc++ regexes were adjusted
in https://reviews.llvm.org/D57466, and so did the order in which we
load the formatters. Then https://reviews.llvm.org/D66398 changed the
`std::list` regex, to make sure the libc++ formatters don't match the
`cxx11` libstdc++ [Dual ABI
namespace](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html).

But we changed the order in which we load the formatters again in
https://github.com/llvm/llvm-project/pull/140727. The intention there
was to load libstdc++ first, because it may have inline namespaces that
would match relaxed the libc++ regexes. So that should technically make
this complicated regex workaround obsolete.

I didn't quite follow the entire thread in D66398 because some of the
links are dead. So it's possible something does rely on this. I'd like
to remove it and see. I *think* this should be resolved now by virtue of
how we load the formatters, but if it does break someone, there ought to
be a better solution (as Pavel hinted at in D66398).

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index ae6086ff89d71..dd3b84e47dec3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -880,11 +880,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   AddCXXSynthetic(
       cpp_category_sp,
       lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
-      "libc++ std::list synthetic children",
-      // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
-      // so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
-      "^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
-      "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
+      "libc++ std::list synthetic children", "^std::__[[:alnum:]]+::list<.+>$",
       stl_deref_flags, true);
   AddCXXSynthetic(
       cpp_category_sp,
@@ -1006,14 +1002,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
       cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
       "libc++ std::list summary provider",
       "^std::__[[:alnum:]]+::forward_list<.+>$", stl_summary_flags, true);
-  AddCXXSummary(
-      cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
-      "libc++ std::list summary provider",
-      // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
-      // so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
-      "^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
-      "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
-      stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+                lldb_private::formatters::ContainerSizeSummaryProvider,
+                "libc++ std::list summary provider",
+                "^std::__[[:alnum:]]+::list<.+>$", stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
                 lldb_private::formatters::ContainerSizeSummaryProvider,
                 "libc++ std::map summary provider",


        


More information about the lldb-commits mailing list