[Lldb-commits] [PATCH] D23884: Add StructuredData unit tests; remove JSON parsing string copy

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 26 09:07:10 PDT 2016


zturner added a subscriber: zturner.
zturner added a comment.

I'm not sure I follow.  `StringRef` is literally just a wrapper around a `const char*`, so if `const char*` works, why doesn't `StringRef`?  `JSONParser` constructor is already taking a `const char*` in this patch, so it's not like it is modifying the contents of the string.

Checking the length and/or getting a substring or trimming values from the beginning and end is going to be a far more common operation than converting it into something that has to be null terminated (why does it have to be null terminated for that matter anyway?), so the benefit of having the length stored with the string outweighs the con of having to call `str()` when you want something null terminated, IMO


https://reviews.llvm.org/D23884





More information about the lldb-commits mailing list