[Lldb-commits] [lldb] [lldb] Replace ConstString in FormatEntity.cpp (PR #225523)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 24 12:05:30 PDT 2026


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

>From 867da315952c195af0ab8b9fd2b3aae0a65c6231 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Tue, 22 Sep 2026 14:02:54 -0700
Subject: [PATCH 1/4] [lldb] Replace ConstString in FormatEntity.cpp

---
 lldb/source/Core/FormatEntity.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index ebe2b00ff88bc..b911c4c55379a 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -41,7 +41,6 @@
 #include "lldb/Utility/AnsiTerminal.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/CompletionRequest.h"
-#include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
@@ -1004,9 +1003,12 @@ bool FormatEntity::Formatter::DumpValue(Stream &s,
     llvm::StringRef special_directions;
     if (close_bracket_index != llvm::StringRef::npos &&
         subpath.size() > close_bracket_index) {
-      ConstString additional_data(subpath.drop_front(close_bracket_index + 1));
-      special_directions_stream.Printf("${%svar%s", do_deref_pointer ? "*" : "",
-                                       additional_data.GetCString());
+      llvm::StringRef additional_data(
+          subpath.drop_front(close_bracket_index + 1));
+      special_directions_stream
+          << "${"
+          << llvm::formatv("{0}var{1}", do_deref_pointer ? "*" : "",
+                           additional_data);
 
       if (entry.fmt != eFormatDefault) {
         const char format_char =

>From e564663cc6b66342fec3a0d2f3ffd0b4c0328e68 Mon Sep 17 00:00:00 2001
From: Alex Langford <nirvashtzero at gmail.com>
Date: Wed, 23 Sep 2026 12:58:28 -0700
Subject: [PATCH 2/4] Update lldb/source/Core/FormatEntity.cpp

Co-authored-by: Med Ismail Bennani <ismail at bennani.ma>
---
 lldb/source/Core/FormatEntity.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index b911c4c55379a..61814bb0f8595 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -1006,8 +1006,7 @@ bool FormatEntity::Formatter::DumpValue(Stream &s,
       llvm::StringRef additional_data(
           subpath.drop_front(close_bracket_index + 1));
       special_directions_stream
-          << "${"
-          << llvm::formatv("{0}var{1}", do_deref_pointer ? "*" : "",
+          << llvm::formatv("$\{{0}var{1}", do_deref_pointer ? "*" : "",
                            additional_data);
 
       if (entry.fmt != eFormatDefault) {

>From 3f91801d8ca2d78e5a97327d51412d99f933769e Mon Sep 17 00:00:00 2001
From: Alex Langford <nirvashtzero at gmail.com>
Date: Wed, 23 Sep 2026 15:10:42 -0700
Subject: [PATCH 3/4] Update lldb/source/Core/FormatEntity.cpp

Co-authored-by: Med Ismail Bennani <ismail at bennani.ma>
---
 lldb/source/Core/FormatEntity.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 61814bb0f8595..d2fcba185a8bf 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -1007,7 +1007,6 @@ bool FormatEntity::Formatter::DumpValue(Stream &s,
           subpath.drop_front(close_bracket_index + 1));
       special_directions_stream
           << llvm::formatv("$\{{0}var{1}", do_deref_pointer ? "*" : "",
-                           additional_data);
 
       if (entry.fmt != eFormatDefault) {
         const char format_char =

>From 406bd51780761997308c674413a501635bc190ac Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Wed, 23 Sep 2026 16:43:46 -0700
Subject: [PATCH 4/4] fix

---
 lldb/source/Core/FormatEntity.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index d2fcba185a8bf..589498168ff4f 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -1005,8 +1005,8 @@ bool FormatEntity::Formatter::DumpValue(Stream &s,
         subpath.size() > close_bracket_index) {
       llvm::StringRef additional_data(
           subpath.drop_front(close_bracket_index + 1));
-      special_directions_stream
-          << llvm::formatv("$\{{0}var{1}", do_deref_pointer ? "*" : "",
+      special_directions_stream << llvm::formatv(
+          "$\{{0}var{1}", do_deref_pointer ? "*" : "", additional_data);
 
       if (entry.fmt != eFormatDefault) {
         const char format_char =



More information about the lldb-commits mailing list