https://github.com/bulbazord updated 
https://github.com/llvm/llvm-project/pull/205429

>From 0ce9937c14d12637eb65485a3b2f49e1cc332408 Mon Sep 17 00:00:00 2001
From: Alex Langford <[email protected]>
Date: Tue, 23 Jun 2026 13:51:25 -0700
Subject: [PATCH 1/2] [lldb][NFC] Change type of Breakpoint's name list

This is currently a `std::unordered_set<std::string>`. The downside of
this is that you need to have a `std::string` to perform a lookup of any
kind. This often requires a potential allocation any time we want to
query the name list. Even using `std::string_view` is not sufficient to
perform a lookup.

I propose that this instead be a `llvm::StringSet` which has accepts
StringRefs as its primary currency for insertions, lookups, and more.
---
 lldb/include/lldb/Breakpoint/Breakpoint.h | 14 ++++++++------
 lldb/source/Breakpoint/Breakpoint.cpp     |  6 +++---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index 67a741c6c9251..db04fc9114e56 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -27,6 +27,8 @@
 #include "lldb/Utility/StringList.h"
 #include "lldb/Utility/StructuredData.h"
 
+#include "llvm/ADT/StringSet.h"
+
 namespace lldb_private {
 
 /// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that
@@ -583,8 +585,8 @@ class Breakpoint : public 
std::enable_shared_from_this<Breakpoint>,
 
   void GetNames(std::vector<std::string> &names) {
     names.clear();
-    for (auto name : m_name_list) {
-      names.push_back(name);
+    for (auto name : m_name_list.keys()) {
+      names.push_back(name.str());
     }
   }
 
@@ -687,10 +689,10 @@ class Breakpoint : public 
std::enable_shared_from_this<Breakpoint>,
   bool
       m_hardware; // If this breakpoint is required to use a hardware 
breakpoint
   Target &m_target; // The target that holds this breakpoint.
-  std::unordered_set<std::string> m_name_list; // If not empty, this is the 
name
-                                               // of this breakpoint (many
-                                               // breakpoints can share the 
same
-                                               // name.)
+  llvm::StringSet<> m_name_list; // If not empty, this is the name
+                                 // of this breakpoint (many
+                                 // breakpoints can share the same
+                                 // name.)
   lldb::SearchFilterSP
       m_filter_sp; // The filter that constrains the breakpoint's domain.
   lldb::BreakpointResolverSP
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 07412cd092f0d..9bc014b86e2d6 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -88,7 +88,7 @@ StructuredData::ObjectSP 
Breakpoint::SerializeToStructuredData() {
 
   if (!m_name_list.empty()) {
     StructuredData::ArraySP names_array_sp(new StructuredData::Array());
-    for (auto name : m_name_list) {
+    for (auto name : m_name_list.keys()) {
       names_array_sp->AddItem(std::make_shared<StructuredData::String>(name));
     }
     breakpoint_contents_sp->AddItem(Breakpoint::GetKey(OptionNames::Names),
@@ -1003,9 +1003,9 @@ void Breakpoint::GetDescriptionForType(Stream *s, 
lldb::DescriptionLevel level,
         s->Printf("Names:");
         s->EOL();
         s->IndentMore();
-        for (const std::string &name : m_name_list) {
+        for (llvm::StringRef name : m_name_list.keys()) {
           s->Indent();
-          s->Printf("%s\n", name.c_str());
+          s->Format("{0}\n", name);
         }
         s->IndentLess();
       }

>From e72b42d3dd29f853bbc379e03fc569b010352e31 Mon Sep 17 00:00:00 2001
From: Alex Langford <[email protected]>
Date: Tue, 23 Jun 2026 16:03:24 -0700
Subject: [PATCH 2/2] Update lldb/include/lldb/Breakpoint/Breakpoint.h

Co-authored-by: Jonas Devlieghere <[email protected]>
---
 lldb/include/lldb/Breakpoint/Breakpoint.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index db04fc9114e56..c6bbc83501832 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -689,10 +689,9 @@ class Breakpoint : public 
std::enable_shared_from_this<Breakpoint>,
   bool
       m_hardware; // If this breakpoint is required to use a hardware 
breakpoint
   Target &m_target; // The target that holds this breakpoint.
-  llvm::StringSet<> m_name_list; // If not empty, this is the name
-                                 // of this breakpoint (many
-                                 // breakpoints can share the same
-                                 // name.)
+  /// If not empty, this is the name of this breakpoint (many breakpoints can
+  /// share the same name.)
+  llvm::StringSet<> m_name_list; 
   lldb::SearchFilterSP
       m_filter_sp; // The filter that constrains the breakpoint's domain.
   lldb::BreakpointResolverSP

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to