[PATCH] D25255: Add a c_str() method to StringRef, similar to data() but asserting if the string isn't null terminated (NFC)

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 15:22:15 PDT 2016


zturner added a comment.

Not sure how I feel about this.  It's convenient, but it has potential for abuse.  Where did you run into issues porting code to `StringRef` that this solves?  I've done a lot of `StringRef` porting in LLDB by now, and I've always managed to find a solution to this.  Usually it involves trickling the `StringRef` changes down further (often in a separate CL that can be made more isolated) and then coming back to your original CL, where now you have `StringRef`s to work with rather than `const char *`.  Does that not work in your cases?


https://reviews.llvm.org/D25255





More information about the llvm-commits mailing list