shafik added inline comments.

================
Comment at: lldb/source/DataFormatters/StringPrinter.cpp:175
+  constexpr unsigned max_buffer_size = 7;
+  uint8_t *data = new uint8_t[max_buffer_size];
+  switch (escape_style) {
----------------
I really wish we could get ride of the naked `new`. It seems possible.

- We know the buffer size
- We know the "expected" escaped_len
- We could write something like a `make_StringPrinterBufferPointer` in the same 
spirit as `make_unique`

The problem we want to avoid w/ the naked `new` is that the code becomes more 
complicated over time and somehow a later change disconnects the `new` w/ the 
creation of the `StringPrinterBufferPointer` which manages the lifetime. 

This comment applies to the code later on as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77843/new/

https://reviews.llvm.org/D77843



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to