clayborg added a comment.

Looking closer at the JSON parser llvm::StringRef isn't the right thing to use 
when parsing JSON. The parser will often remove desensitizing characters from 
say a string like:

  "hello \"world\""

And when parsing a token in JSONParser::GetToken, we can't just hand out a 
llvm::StringRef do this data in memory. The function prototype is:

  JSONParser::Token
  JSONParser::GetToken (std::string &value)

This would mean we would need "value" to be able to have a new backing store in 
case the values don't match what is in the JSON text buffer which would defeat 
the purpose of using llvm::StringRef. We could make a struct like:

  struct ParseString
  {
      llvm::StringRef value;
      std::string backing_store;
  };

But then the code becomes more complex for no real benefit.


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