Skip to content

Commit 98aa840

Browse files
authored
[lldb][Formatters] Simplify std::list libc++ formatter matching regex (llvm#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 llvm#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).
1 parent 1b7f272 commit 98aa840

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
880880
AddCXXSynthetic(
881881
cpp_category_sp,
882882
lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
883-
"libc++ std::list synthetic children",
884-
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
885-
// so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
886-
"^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
887-
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
883+
"libc++ std::list synthetic children", "^std::__[[:alnum:]]+::list<.+>$",
888884
stl_deref_flags, true);
889885
AddCXXSynthetic(
890886
cpp_category_sp,
@@ -1006,14 +1002,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
10061002
cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
10071003
"libc++ std::list summary provider",
10081004
"^std::__[[:alnum:]]+::forward_list<.+>$", stl_summary_flags, true);
1009-
AddCXXSummary(
1010-
cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider,
1011-
"libc++ std::list summary provider",
1012-
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
1013-
// so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
1014-
"^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
1015-
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
1016-
stl_summary_flags, true);
1005+
AddCXXSummary(cpp_category_sp,
1006+
lldb_private::formatters::ContainerSizeSummaryProvider,
1007+
"libc++ std::list summary provider",
1008+
"^std::__[[:alnum:]]+::list<.+>$", stl_summary_flags, true);
10171009
AddCXXSummary(cpp_category_sp,
10181010
lldb_private::formatters::ContainerSizeSummaryProvider,
10191011
"libc++ std::map summary provider",

0 commit comments

Comments
 (0)