Skip to content

[lldb] Replace ConstString in FormatEntity.cpp - #225523

Open
bulbazord wants to merge 4 commits into
llvm:mainfrom
bulbazord:CS-FormatEntity
Open

bulbazord wants to merge 4 commits into
llvm:mainfrom
bulbazord:CS-FormatEntity

Conversation

@bulbazord

Copy link
Copy Markdown
Member

No description provided.

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/225523.diff

1 Files Affected:

  • (modified) lldb/source/Core/FormatEntity.cpp (+6-4)
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index e886453a45908..7d9856b615f4c 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 =

Comment thread lldb/source/Core/FormatEntity.cpp Outdated

@medismailben medismailben left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JDevlieghere JDevlieghere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with Ismail's suggestion.

bulbazord and others added 3 commits September 23, 2026 12:58
Co-authored-by: Med Ismail Bennani <ismail@bennani.ma>
Co-authored-by: Med Ismail Bennani <ismail@bennani.ma>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants