================
@@ -95,6 +99,9 @@ class StringPrinter {
/// True iff a zero bytes ('\0') should terminate the memory region that
/// is being dumped.
bool m_zero_is_terminator = true;
+ /// True iff trailing zero bytes should be stripped from the string.
+ /// Mutually exclusive with `m_zero_is_terminator`.
----------------
Nerixyz wrote:
> Also, if you're matching `char` behavior, why is it necessary to include a
> new flag? Is it because the `char` code does not go through the string
> printer?
It does go through the string printer, but it supplies an existing buffer
that's already trimmed. The trimming is done here:
https://github.com/llvm/llvm-project/blob/58f94f0a4648a5d8d624c05a51dea8c37e5fe7bc/lldb/source/ValueObject/ValueObject.cpp#L893-L900
This is used in `ValueObject::ReadPointedString`, which gets the buffer.
The `charN_t` formatters also use the functionality to read a string with the
`StringPrinter`.
> Maybe this means this should be replaced by a tri-state enum? Did you try how
> that would look like?
I did this in [`0368645` (this
PR)](https://github.com/llvm/llvm-project/pull/195514/commits/036864574f81998e47192f12ef83191a8e72e0a6).
https://github.com/llvm/llvm-project/pull/195514
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits