[libcxx-commits] [PATCH] D154499: [libc++] Do not use stringbuf's string after move
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 13 16:55:55 PDT 2023
ldionne commandeered this revision.
ldionne added a reviewer: pfusik.
ldionne added a comment.
Commandeering to finish for the GH PR transition.
After consideration, I think our current tests are lacking a bit but there is no risk of use-after-move. Indeed, when we set `__p = const_cast<char_type*>(__rhs.__str_.data());`, `__p` is:
- `nullptr` if the string was not using SSO, because it was moved-out-from above in `__str_ = _VSTD::move(__rhs.__str_);`
- a pointer to the start of the SSO inside `__rhs.__str_` if the string was using SSO
Either way, we are not reusing the storage incorrectly. I will commandeer and fix the tests, but I think our current implementation is fine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154499/new/
https://reviews.llvm.org/D154499
More information about the libcxx-commits
mailing list