Skip to content

Commit 074630e

Browse files
authored
[lldb] Remove unnecessary suffix from libc++ type name patterns (NFC) (#79644)
The `(( )?&)?` appears to match types which are references. However lldb can load the correct data formatters without having to pattern match against a `&` suffix. The suffix may have been needed at one point, but it's no longer needed.
1 parent 1d5820a commit 074630e

File tree

1 file changed

+79
-87
lines changed

1 file changed

+79
-87
lines changed

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

Lines changed: 79 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -744,46 +744,46 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
744744
cpp_category_sp,
745745
lldb_private::formatters::LibcxxBitsetSyntheticFrontEndCreator,
746746
"libc++ std::bitset synthetic children",
747-
"^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$", stl_deref_flags, true);
747+
"^std::__[[:alnum:]]+::bitset<.+>$", stl_deref_flags, true);
748748
AddCXXSynthetic(
749749
cpp_category_sp,
750750
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator,
751751
"libc++ std::vector synthetic children",
752-
"^std::__[[:alnum:]]+::vector<.+>(( )?&)?$", stl_deref_flags, true);
752+
"^std::__[[:alnum:]]+::vector<.+>$", stl_deref_flags, true);
753753
AddCXXSynthetic(
754754
cpp_category_sp,
755755
lldb_private::formatters::LibcxxStdForwardListSyntheticFrontEndCreator,
756756
"libc++ std::forward_list synthetic children",
757-
"^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$", stl_synth_flags, true);
757+
"^std::__[[:alnum:]]+::forward_list<.+>$", stl_synth_flags, true);
758758
AddCXXSynthetic(
759759
cpp_category_sp,
760760
lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
761761
"libc++ std::list synthetic children",
762-
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
763-
// so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
762+
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
763+
// so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
764764
"^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
765-
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$",
765+
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
766766
stl_deref_flags, true);
767767
AddCXXSynthetic(
768768
cpp_category_sp,
769769
lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
770-
"libc++ std::map synthetic children",
771-
"^std::__[[:alnum:]]+::map<.+> >(( )?&)?$", stl_synth_flags, true);
770+
"libc++ std::map synthetic children", "^std::__[[:alnum:]]+::map<.+> >$",
771+
stl_synth_flags, true);
772772
AddCXXSynthetic(
773773
cpp_category_sp,
774774
lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
775-
"libc++ std::set synthetic children",
776-
"^std::__[[:alnum:]]+::set<.+> >(( )?&)?$", stl_deref_flags, true);
775+
"libc++ std::set synthetic children", "^std::__[[:alnum:]]+::set<.+> >$",
776+
stl_deref_flags, true);
777777
AddCXXSynthetic(
778778
cpp_category_sp,
779779
lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
780780
"libc++ std::multiset synthetic children",
781-
"^std::__[[:alnum:]]+::multiset<.+> >(( )?&)?$", stl_deref_flags, true);
781+
"^std::__[[:alnum:]]+::multiset<.+> >$", stl_deref_flags, true);
782782
AddCXXSynthetic(
783783
cpp_category_sp,
784784
lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
785785
"libc++ std::multimap synthetic children",
786-
"^std::__[[:alnum:]]+::multimap<.+> >(( )?&)?$", stl_synth_flags, true);
786+
"^std::__[[:alnum:]]+::multimap<.+> >$", stl_synth_flags, true);
787787
AddCXXSynthetic(
788788
cpp_category_sp,
789789
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator,
@@ -794,23 +794,19 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
794794
cpp_category_sp,
795795
lldb_private::formatters::LibcxxInitializerListSyntheticFrontEndCreator,
796796
"libc++ std::initializer_list synthetic children",
797-
"^std::initializer_list<.+>(( )?&)?$", stl_synth_flags, true);
797+
"^std::initializer_list<.+>$", stl_synth_flags, true);
798798
AddCXXSynthetic(cpp_category_sp, LibcxxQueueFrontEndCreator,
799799
"libc++ std::queue synthetic children",
800-
"^std::__[[:alnum:]]+::queue<.+>(( )?&)?$", stl_synth_flags,
801-
true);
800+
"^std::__[[:alnum:]]+::queue<.+>$", stl_synth_flags, true);
802801
AddCXXSynthetic(cpp_category_sp, LibcxxTupleFrontEndCreator,
803802
"libc++ std::tuple synthetic children",
804-
"^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$", stl_synth_flags,
805-
true);
803+
"^std::__[[:alnum:]]+::tuple<.*>$", stl_synth_flags, true);
806804
AddCXXSynthetic(cpp_category_sp, LibcxxOptionalSyntheticFrontEndCreator,
807805
"libc++ std::optional synthetic children",
808-
"^std::__[[:alnum:]]+::optional<.+>(( )?&)?$",
809-
stl_synth_flags, true);
806+
"^std::__[[:alnum:]]+::optional<.+>$", stl_synth_flags, true);
810807
AddCXXSynthetic(cpp_category_sp, LibcxxVariantFrontEndCreator,
811808
"libc++ std::variant synthetic children",
812-
"^std::__[[:alnum:]]+::variant<.+>(( )?&)?$", stl_synth_flags,
813-
true);
809+
"^std::__[[:alnum:]]+::variant<.+>$", stl_synth_flags, true);
814810
AddCXXSynthetic(
815811
cpp_category_sp,
816812
lldb_private::formatters::LibcxxAtomicSyntheticFrontEndCreator,
@@ -819,17 +815,16 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
819815
AddCXXSynthetic(
820816
cpp_category_sp,
821817
lldb_private::formatters::LibcxxStdSpanSyntheticFrontEndCreator,
822-
"libc++ std::span synthetic children",
823-
"^std::__[[:alnum:]]+::span<.+>(( )?&)?$", stl_deref_flags, true);
818+
"libc++ std::span synthetic children", "^std::__[[:alnum:]]+::span<.+>$",
819+
stl_deref_flags, true);
824820
AddCXXSynthetic(
825821
cpp_category_sp,
826822
lldb_private::formatters::LibcxxStdRangesRefViewSyntheticFrontEndCreator,
827823
"libc++ std::ranges::ref_view synthetic children",
828-
"^std::__[[:alnum:]]+::ranges::ref_view<.+>(( )?&)?$", stl_deref_flags,
829-
true);
824+
"^std::__[[:alnum:]]+::ranges::ref_view<.+>$", stl_deref_flags, true);
830825

831826
cpp_category_sp->AddTypeSynthetic(
832-
"^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$", eFormatterMatchRegex,
827+
"^(std::__[[:alnum:]]+::)deque<.+>$", eFormatterMatchRegex,
833828
SyntheticChildrenSP(new ScriptedSyntheticChildren(
834829
stl_synth_flags,
835830
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -838,10 +833,10 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
838833
cpp_category_sp,
839834
lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
840835
"shared_ptr synthetic children",
841-
"^(std::__[[:alnum:]]+::)shared_ptr<.+>(( )?&)?$", stl_synth_flags, true);
836+
"^(std::__[[:alnum:]]+::)shared_ptr<.+>$", stl_synth_flags, true);
842837

843838
static constexpr const char *const libcxx_std_unique_ptr_regex =
844-
"^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$";
839+
"^std::__[[:alnum:]]+::unique_ptr<.+>$";
845840
AddCXXSynthetic(
846841
cpp_category_sp,
847842
lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEndCreator,
@@ -851,15 +846,15 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
851846
AddCXXSynthetic(
852847
cpp_category_sp,
853848
lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator,
854-
"weak_ptr synthetic children",
855-
"^(std::__[[:alnum:]]+::)weak_ptr<.+>(( )?&)?$", stl_synth_flags, true);
849+
"weak_ptr synthetic children", "^(std::__[[:alnum:]]+::)weak_ptr<.+>$",
850+
stl_synth_flags, true);
856851
AddCXXSummary(cpp_category_sp,
857852
lldb_private::formatters::LibcxxFunctionSummaryProvider,
858853
"libc++ std::function summary provider",
859854
"^std::__[[:alnum:]]+::function<.+>$", stl_summary_flags, true);
860855

861856
static constexpr const char *const libcxx_std_coroutine_handle_regex =
862-
"^std::__[[:alnum:]]+::coroutine_handle<.+>(( )?&)?$";
857+
"^std::__[[:alnum:]]+::coroutine_handle<.+>$";
863858
AddCXXSynthetic(
864859
cpp_category_sp,
865860
lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEndCreator,
@@ -868,89 +863,86 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
868863

869864
stl_summary_flags.SetDontShowChildren(false);
870865
stl_summary_flags.SetSkipPointers(false);
871-
AddCXXSummary(
872-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
873-
"libc++ std::bitset summary provider",
874-
"^std::__[[:alnum:]]+::bitset<.+>(( )?&)?$", stl_summary_flags, true);
875-
AddCXXSummary(
876-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
877-
"libc++ std::vector summary provider",
878-
"^std::__[[:alnum:]]+::vector<.+>(( )?&)?$", stl_summary_flags, true);
879866
AddCXXSummary(cpp_category_sp,
880867
lldb_private::formatters::LibcxxContainerSummaryProvider,
881-
"libc++ std::list summary provider",
882-
"^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$",
883-
stl_summary_flags, true);
868+
"libc++ std::bitset summary provider",
869+
"^std::__[[:alnum:]]+::bitset<.+>$", stl_summary_flags, true);
870+
AddCXXSummary(cpp_category_sp,
871+
lldb_private::formatters::LibcxxContainerSummaryProvider,
872+
"libc++ std::vector summary provider",
873+
"^std::__[[:alnum:]]+::vector<.+>$", stl_summary_flags, true);
884874
AddCXXSummary(
885875
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
886876
"libc++ std::list summary provider",
887-
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
888-
// so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
889-
"^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
890-
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$",
891-
stl_summary_flags, true);
892-
AddCXXSummary(
893-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
894-
"libc++ std::map summary provider",
895-
"^std::__[[:alnum:]]+::map<.+>(( )?&)?$", stl_summary_flags, true);
896-
AddCXXSummary(
897-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
898-
"libc++ std::deque summary provider",
899-
"^std::__[[:alnum:]]+::deque<.+>(( )?&)?$", stl_summary_flags, true);
900-
AddCXXSummary(
901-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
902-
"libc++ std::queue summary provider",
903-
"^std::__[[:alnum:]]+::queue<.+>(( )?&)?$", stl_summary_flags, true);
877+
"^std::__[[:alnum:]]+::forward_list<.+>$", stl_summary_flags, true);
904878
AddCXXSummary(
905879
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
906-
"libc++ std::set summary provider",
907-
"^std::__[[:alnum:]]+::set<.+>(( )?&)?$", stl_summary_flags, true);
908-
AddCXXSummary(
909-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
910-
"libc++ std::multiset summary provider",
911-
"^std::__[[:alnum:]]+::multiset<.+>(( )?&)?$", stl_summary_flags, true);
912-
AddCXXSummary(
913-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
914-
"libc++ std::multimap summary provider",
915-
"^std::__[[:alnum:]]+::multimap<.+>(( )?&)?$", stl_summary_flags, true);
880+
"libc++ std::list summary provider",
881+
// A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>$"
882+
// so that it does not clash with: "^std::(__cxx11::)?list<.+>$"
883+
"^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
884+
"cxx11[[:alnum:]])[[:alnum:]]*::list<.+>$",
885+
stl_summary_flags, true);
886+
AddCXXSummary(cpp_category_sp,
887+
lldb_private::formatters::LibcxxContainerSummaryProvider,
888+
"libc++ std::map summary provider",
889+
"^std::__[[:alnum:]]+::map<.+>$", stl_summary_flags, true);
890+
AddCXXSummary(cpp_category_sp,
891+
lldb_private::formatters::LibcxxContainerSummaryProvider,
892+
"libc++ std::deque summary provider",
893+
"^std::__[[:alnum:]]+::deque<.+>$", stl_summary_flags, true);
894+
AddCXXSummary(cpp_category_sp,
895+
lldb_private::formatters::LibcxxContainerSummaryProvider,
896+
"libc++ std::queue summary provider",
897+
"^std::__[[:alnum:]]+::queue<.+>$", stl_summary_flags, true);
898+
AddCXXSummary(cpp_category_sp,
899+
lldb_private::formatters::LibcxxContainerSummaryProvider,
900+
"libc++ std::set summary provider",
901+
"^std::__[[:alnum:]]+::set<.+>$", stl_summary_flags, true);
902+
AddCXXSummary(cpp_category_sp,
903+
lldb_private::formatters::LibcxxContainerSummaryProvider,
904+
"libc++ std::multiset summary provider",
905+
"^std::__[[:alnum:]]+::multiset<.+>$", stl_summary_flags, true);
906+
AddCXXSummary(cpp_category_sp,
907+
lldb_private::formatters::LibcxxContainerSummaryProvider,
908+
"libc++ std::multimap summary provider",
909+
"^std::__[[:alnum:]]+::multimap<.+>$", stl_summary_flags, true);
916910
AddCXXSummary(cpp_category_sp,
917911
lldb_private::formatters::LibcxxContainerSummaryProvider,
918912
"libc++ std::unordered containers summary provider",
919913
"^(std::__[[:alnum:]]+::)unordered_(multi)?(map|set)<.+> >$",
920914
stl_summary_flags, true);
921915
AddCXXSummary(cpp_category_sp, LibcxxContainerSummaryProvider,
922916
"libc++ std::tuple summary provider",
923-
"^std::__[[:alnum:]]+::tuple<.*>(( )?&)?$", stl_summary_flags,
924-
true);
917+
"^std::__[[:alnum:]]+::tuple<.*>$", stl_summary_flags, true);
925918
AddCXXSummary(cpp_category_sp,
926919
lldb_private::formatters::LibCxxAtomicSummaryProvider,
927920
"libc++ std::atomic summary provider",
928921
"^std::__[[:alnum:]]+::atomic<.+>$", stl_summary_flags, true);
929-
AddCXXSummary(
930-
cpp_category_sp, lldb_private::formatters::GenericOptionalSummaryProvider,
931-
"libc++ std::optional summary provider",
932-
"^std::__[[:alnum:]]+::optional<.+>(( )?&)?$", stl_summary_flags, true);
933-
AddCXXSummary(
934-
cpp_category_sp, lldb_private::formatters::LibcxxVariantSummaryProvider,
935-
"libc++ std::variant summary provider",
936-
"^std::__[[:alnum:]]+::variant<.+>(( )?&)?$", stl_summary_flags, true);
937-
AddCXXSummary(
938-
cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
939-
"libc++ std::span summary provider",
940-
"^std::__[[:alnum:]]+::span<.+>(( )?&)?$", stl_summary_flags, true);
922+
AddCXXSummary(cpp_category_sp,
923+
lldb_private::formatters::GenericOptionalSummaryProvider,
924+
"libc++ std::optional summary provider",
925+
"^std::__[[:alnum:]]+::optional<.+>$", stl_summary_flags, true);
926+
AddCXXSummary(cpp_category_sp,
927+
lldb_private::formatters::LibcxxVariantSummaryProvider,
928+
"libc++ std::variant summary provider",
929+
"^std::__[[:alnum:]]+::variant<.+>$", stl_summary_flags, true);
930+
AddCXXSummary(cpp_category_sp,
931+
lldb_private::formatters::LibcxxContainerSummaryProvider,
932+
"libc++ std::span summary provider",
933+
"^std::__[[:alnum:]]+::span<.+>$", stl_summary_flags, true);
941934

942935
stl_summary_flags.SetSkipPointers(true);
943936

944937
AddCXXSummary(cpp_category_sp,
945938
lldb_private::formatters::LibcxxSmartPointerSummaryProvider,
946939
"libc++ std::shared_ptr summary provider",
947-
"^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$",
948-
stl_summary_flags, true);
940+
"^std::__[[:alnum:]]+::shared_ptr<.+>$", stl_summary_flags,
941+
true);
949942
AddCXXSummary(cpp_category_sp,
950943
lldb_private::formatters::LibcxxSmartPointerSummaryProvider,
951944
"libc++ std::weak_ptr summary provider",
952-
"^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$",
953-
stl_summary_flags, true);
945+
"^std::__[[:alnum:]]+::weak_ptr<.+>$", stl_summary_flags, true);
954946
AddCXXSummary(cpp_category_sp,
955947
lldb_private::formatters::LibcxxUniquePointerSummaryProvider,
956948
"libc++ std::unique_ptr summary provider",

0 commit comments

Comments
 (0)