[PATCH] D27721: Add a c_str() member to StringLiteral

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 16:09:23 PST 2016

zturner added a comment.

In https://reviews.llvm.org/D27721#621660, @ruiu wrote:

> As to StringRefZ, I was about to propose StringRef to compute string length lazily, so that I could use it to represent strings in string table. I didn't because it would things hard to debug (because you get errors lazily.) But maybe it makes sense?

Maybe I'd need to see an actual proposal, but I'm having trouble imagining what you had in mind.  Would you just call `strlen` on every call to `StringRef::size()`?  Or store an extra `bool` in the class that says whether the length is known?

What would be the advantage and why does this laziness help in a string table?


More information about the llvm-commits mailing list