[all-commits] [llvm/llvm-project] 5351de: [libc++] Remove usage of internal string function ...

Tacet via All-commits all-commits at lists.llvm.org
Mon Jan 8 09:56:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5351ded68d579921a61b26a34e36046c22f668bd
      https://github.com/llvm/llvm-project/commit/5351ded68d579921a61b26a34e36046c22f668bd
  Author: Tacet <advenam.tacet at trailofbits.com>
  Date:   2024-01-08 (Mon, 08 Jan 2024)

  Changed paths:
    M libcxx/include/sstream

  Log Message:
  -----------
  [libc++] Remove usage of internal string function in sstream (#75858)

This function replaces a call to `__move_assign` (internal function)
with two calls to public member functions (`resize` and `erase`). The
order of calls is chosen for the best performance.

This change is required to [turn on ASan string annotations for short
strings](https://github.com/llvm/llvm-project/pull/75882) (Short String
Optimization - SSO).

The `std::basic_string` class's `void __move_assign(basic_string&&
__str, size_type __pos, size_type __len)` function operates on
uninitialized strings, where it is reasonable to assume that the memory
is not poisoned. However, in `sstream` this function is applied to
existing strings that already have poisoned memory.

String ASan annotations turned on here:
https://github.com/llvm/llvm-project/pull/72677




More information about the All-commits mailing list