[Lldb-commits] [lldb] [lldb] Remove ConstString from DumpValueObjectOptions (PR #215421)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 10 15:47:47 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Alex Langford (bulbazord)
<details>
<summary>Changes</summary>
There are 2 uses of ConstString in DumpValueObjectOptions: DeclPrintingHelper and ChildPrintingDecider, both being std::functions. The former takes 2 ConstString arguments and the latter takes just one.
These functions don't really need their arguments (type names, var names, register names) to actually be in a ConstString. For the most part, they are just printing the string out or otherwise analyzing it.
---
Full diff: https://github.com/llvm/llvm-project/pull/215421.diff
3 Files Affected:
- (modified) lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h (+2-2)
- (modified) lldb/source/Commands/CommandObjectFrame.cpp (+1-1)
- (modified) lldb/source/Core/DumpRegisterValue.cpp (+2-2)
``````````diff
diff --git a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
index 70166f33cfc45..5c7f9ca69cea6 100644
--- a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
+++ b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -48,11 +48,11 @@ class DumpValueObjectOptions {
operator bool() { return m_element_count > 0; }
};
- typedef std::function<bool(ConstString, ConstString,
+ typedef std::function<bool(llvm::StringRef, llvm::StringRef,
const DumpValueObjectOptions &, Stream &)>
DeclPrintingHelper;
- typedef std::function<bool(ConstString)> ChildPrintingDecider;
+ typedef std::function<bool(llvm::StringRef)> ChildPrintingDecider;
static const DumpValueObjectOptions DefaultOptions() {
static DumpValueObjectOptions g_default_options;
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 5d565709fe6fc..c615ac8ee6118 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -158,7 +158,7 @@ class CommandObjectFrameDiagnose : public CommandObjectParsed {
result.GetValueObjectList().Append(valobj_sp);
DumpValueObjectOptions::DeclPrintingHelper helper =
- [&valobj_sp](ConstString type, ConstString var,
+ [&valobj_sp](llvm::StringRef type, llvm::StringRef var,
const DumpValueObjectOptions &opts,
Stream &stream) -> bool {
const ValueObject::GetExpressionPathFormat format = ValueObject::
diff --git a/lldb/source/Core/DumpRegisterValue.cpp b/lldb/source/Core/DumpRegisterValue.cpp
index 7096cfec5e11c..adb2f533c4c18 100644
--- a/lldb/source/Core/DumpRegisterValue.cpp
+++ b/lldb/source/Core/DumpRegisterValue.cpp
@@ -50,9 +50,9 @@ static void dump_type_value(const lldb_private::RegisterTypeFlags &flags_type,
data_extractor);
lldb_private::DumpValueObjectOptions dump_options;
lldb_private::DumpValueObjectOptions::ChildPrintingDecider decider =
- [](lldb_private::ConstString varname) {
+ [](llvm::StringRef varname) {
// Unnamed bit-fields are padding that we don't want to show.
- return varname.GetLength();
+ return varname.size();
};
dump_options.SetChildPrintingDecider(decider).SetHideRootType(true);
``````````
</details>
https://github.com/llvm/llvm-project/pull/215421
More information about the lldb-commits
mailing list