Skip to content

Commit 2bb2a42

Browse files
authored
[lldb][ValueObject][NFC] Further remove redundant parameters to ReadPointedString (#78029)
We only ever call this function once, without relying on the defaulted `honor_array` parameter, so make it non-defaulted. Also `max_length` is always set to `0`, so remove it entirely. This simplifies some upcoming refactoring.
1 parent c66645d commit 2bb2a42

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lldb/include/lldb/Core/ValueObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ class ValueObject {
670670

671671
std::pair<size_t, bool>
672672
ReadPointedString(lldb::WritableDataBufferSP &buffer_sp, Status &error,
673-
uint32_t max_length = 0, bool honor_array = true);
673+
bool honor_array);
674674

675675
virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
676676
uint32_t item_count = 1);

lldb/source/Core/ValueObject.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,7 @@ static bool CopyStringDataToBufferSP(const StreamString &source,
813813

814814
std::pair<size_t, bool>
815815
ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
816-
Status &error, uint32_t max_length,
817-
bool honor_array) {
816+
Status &error, bool honor_array) {
818817
bool was_capped = false;
819818
StreamString s;
820819
ExecutionContext exe_ctx(GetExecutionContextRef());
@@ -827,8 +826,7 @@ ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
827826
return {0, was_capped};
828827
}
829828

830-
if (max_length == 0)
831-
max_length = target->GetMaximumSizeOfStringSummary();
829+
const auto max_length = target->GetMaximumSizeOfStringSummary();
832830

833831
size_t bytes_read = 0;
834832
size_t total_bytes_read = 0;
@@ -1149,9 +1147,10 @@ bool ValueObject::DumpPrintableRepresentation(
11491147
{
11501148
Status error;
11511149
lldb::WritableDataBufferSP buffer_sp;
1152-
std::pair<size_t, bool> read_string = ReadPointedString(
1153-
buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) ||
1154-
(custom_format == eFormatCharArray));
1150+
std::pair<size_t, bool> read_string =
1151+
ReadPointedString(buffer_sp, error,
1152+
(custom_format == eFormatVectorOfChar) ||
1153+
(custom_format == eFormatCharArray));
11551154
lldb_private::formatters::StringPrinter::
11561155
ReadBufferAndDumpToStreamOptions options(*this);
11571156
options.SetData(DataExtractor(

0 commit comments

Comments
 (0)