[all-commits] [llvm/llvm-project] 5174b3: [libc++] Use __wrap_iter in string_view and array ...

Louis Dionne via All-commits all-commits at lists.llvm.org
Mon Mar 4 15:24:04 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5174b3802575425dcbc58680ccce10961fdb8b67
      https://github.com/llvm/llvm-project/commit/5174b3802575425dcbc58680ccce10961fdb8b67
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M libcxx/include/__config
    M libcxx/include/__iterator/wrap_iter.h
    M libcxx/include/array
    M libcxx/include/string_view

  Log Message:
  -----------
  [libc++] Use __wrap_iter in string_view and array in the unstable ABI (#74482)

std::string_view and std::array iterators don't have to be raw pointers,
and in fact other implementations don't represent them as raw pointers.
Them being raw pointers in libc++ makes it easier for users to write
non-portable code. This is bad in itself, but this is even worse when
considering efforts like hardening where we want an easy ability to
swap for a different iterator type. If users depend on iterators being
raw pointers, this becomes a build break.

Hence, this patch enables the use of __wrap_iter in the unstable ABI,
creating a long term path towards making this the default. This patch
may break code that assumes these iterators are raw pointers for
people compiling with the unstable ABI.

This patch also removes several assumptions that array iterators are
raw pointers in the code base and in the test suite.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list