shafik added inline comments.

================
Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp:29
+    if (sizeof(std::string) == sizeof(garbage_string_sso))
+      memcpy((void *)&garbage1, &garbage_string_sso, sizeof(std::string));
+    if (sizeof(std::string) == sizeof(garbage_string_long))
----------------
While I get what you are doing here, we know he structure of libc++ SSO 
implementation and we are manually building a corrupt one, this is fragile to 
changes in the implementation. 

I don't have an immediate suggestion for an alternative approach but if we 
stick with this we should stick a big comment explaining this, perhaps laying 
out the assumptions of the internal layout we are assuming and maybe some 
sanity checks maybe using `offsetof` to verify fields exist and are where we 
expect them to be.


================
Comment at: lldb/source/DataFormatters/StringPrinter.cpp:64
+static bool isInHalfOpenRange(uint8_t *Needle, uint8_t *Start, uint8_t *End) {
+  return uintptr_t(Needle) >= uintptr_t(Start) &&
+         uintptr_t(Needle) < uintptr_t(End);
----------------
can we use `reinterpret_cast` as opposed to what is basically a C-style cast. 
This also has the advantage of pointing out potentially dangerous code for 
future persons refactoring this code.


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

https://reviews.llvm.org/D73860



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

Reply via email to