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

via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 10 09:27:28 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

<details>
<summary>Changes</summary>

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).

---
Full diff: https://github.com/llvm/llvm-project/pull/147709.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+5-13) 


``````````diff
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",

``````````

</details>


https://github.com/llvm/llvm-project/pull/147709


More information about the lldb-commits mailing list