zturner added a comment.

Actually it looks like `JSONParser` constructor takes a `StringRef` and then 
converts it to a `std::string` internally.  Why can't it just store the 
`StringRef` internally?  It doesn't modify the buffer, and incidentally it also 
keeps a `uint64_t` representing the "offset" into the string.  That's what a 
`StringRef` is.  an immutable buffer and an offset.  Each time you extract 
something, you just say `m_buffer = m_buffer.drop_front(n)`.

There is the `SetFilePos()` method, but it looks like it's only being used for 
two purposes:  1) To move forward, and 2) To reset the position to 0 after 
setting a new string in the extractor.  The first one is still possible with a 
`StringRef` by writing `extractor.skip(n)`, and the second one is still 
possible by writing `extractor.SetString(NewStringRef)`.


https://reviews.llvm.org/D23884



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

Reply via email to