diff options
author | A. Jiang <de34@live.cn> | 2025-06-05 07:23:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-05 07:23:49 +0800 |
commit | 479f9922912e3385655f0ca6e6238aaf09e6320d (patch) | |
tree | a285252459fdc593ef40d9ce46d7303ca6ad311b /llvm/lib/Object/ELF.cpp | |
parent | bac4aa440c12b2f90a1e12ab8aa6e3f842beb387 (diff) | |
download | llvm-479f9922912e3385655f0ca6e6238aaf09e6320d.zip llvm-479f9922912e3385655f0ca6e6238aaf09e6320d.tar.gz llvm-479f9922912e3385655f0ca6e6238aaf09e6320d.tar.bz2 |
[libc++] Fix `basic_string::shrink_to_fit` for constant evaluation (#142712)
Currently, when the string shrink into the SSO buffer, the `__rep_.__s`
member isn't activated before the `traits_type::copy` call
yet, so internal `__builtin_memmove` call writing to the buffer causes
constant evaluation failure. The existing test coverage seems a bit
defective and doesn't cover this case - `shrink_to_fit` is called on the
copy of string after erasure, not the original string object.
This PR reorders the `__set_short_size` call, which starts the lifetime
of the SSO buffer, before the copy operation. Test coverage is achieved
by calling `shrink_to_fit` on the original erased string.
Diffstat (limited to 'llvm/lib/Object/ELF.cpp')
0 files changed, 0 insertions, 0 deletions