[Lldb-commits] [lldb] [lldb] Fix stdcpp type summary mistakenly marked as regex (NFC) (PR #66949)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 20 13:14:31 PDT 2023


https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/66949

`std::basic_string<char>` is not a regex, and treating it as such could unintentionally
cause a formatter to substring match a template type parameter, for example:
`std::vector<std::basic_string<char>>`.

Differential Revision: https://reviews.llvm.org/D158663


>From b943b22bf585acfa65ec812f3af0d48865c9b8ac Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Thu, 17 Aug 2023 16:09:15 -0700
Subject: [PATCH] [lldb] Fix stdcpp type summary mistakenly marked as regex
 (NFC)

`std::basic_string<char>` is not a regex, and treating it as such could unintentionally
cause a formatter to substring match a template type parameter, for example:
`std::vector<std::basic_string<char>>`.

Differential Revision: https://reviews.llvm.org/D158663
---
 lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 3d709e3d6759556..c1743a5e0a418dd 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1009,7 +1009,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   cpp_category_sp->AddTypeSummary("std::string", eFormatterMatchExact,
                                   std_string_summary_sp);
   cpp_category_sp->AddTypeSummary("std::basic_string<char>",
-                                  eFormatterMatchRegex, std_string_summary_sp);
+                                  eFormatterMatchExact, std_string_summary_sp);
   cpp_category_sp->AddTypeSummary(
       "std::basic_string<char,std::char_traits<char>,std::allocator<char> >",
       eFormatterMatchExact, std_string_summary_sp);



More information about the lldb-commits mailing list