[PATCH] D115374: [NFC][clang] Return std::strings built from raw_string_ostreams more efficiently
Logan Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 8 17:55:06 PST 2021
logan-5 added a comment.
To be clear, it sounds like we should //either// add `.take()` for moving the string out of `raw_string_ostream`'s string reference, //or// make `raw_string_ostream` not need to be flushed (after which there won't be as clear a use for `.take()`, since you can just use the underlying string directly).
I vote for the second option, making `raw_string_ostream` not need to be flushed, since it allows for simpler code at the call site (`return Str;`), permits NRVO at the call site, and avoids some possibly weird questions `.take()` would bring with it (like whether it would ever be surprising that it moves out of a //reference// that someone else might also have).
If that's the direction that sounds best, I can submit an updated patch sometime tomorrow.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115374/new/
https://reviews.llvm.org/D115374
More information about the cfe-commits
mailing list