[PATCH] D25257: Use StringRef in Option library instead of raw pointers (NFC)

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 16:52:38 PDT 2016


mehdi_amini added a comment.

> The ownership problem I'm referring to is that if you return a `str.str().c_str()`, the resulting `c_str()` will die immediately, whereas the caller might need the pointer to remain alive.  A `StringSaver` would solve that, so that you could return `Saver.save(str).data()` anywhere you would normally want to return `str.data()`

I see: you're referring to an ownership issue that don't exist in the code but that you want to introduce by forcing allocations where we don't need to.


https://reviews.llvm.org/D25257





More information about the llvm-commits mailing list