[all-commits] [llvm/llvm-project] 427a5c: [libc++] Add support for bounded iterators in std:...

Louis Dionne via All-commits all-commits at lists.llvm.org
Thu Nov 7 06:23:44 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 427a5cf105c409993c812f4fb1868bac96fce0c5
      https://github.com/llvm/llvm-project/commit/427a5cf105c409993c812f4fb1868bac96fce0c5
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2024-11-07 (Thu, 07 Nov 2024)

  Changed paths:
    M libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake
    M libcxx/docs/Hardening.rst
    M libcxx/docs/ReleaseNotes/20.rst
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__configuration/abi.h
    M libcxx/include/__iterator/bounded_iter.h
    A libcxx/include/__iterator/static_bounded_iter.h
    M libcxx/include/array
    M libcxx/include/module.modulemap
    R libcxx/test/libcxx/containers/sequences/array/array.zero/assert.back.pass.cpp
    R libcxx/test/libcxx/containers/sequences/array/array.zero/assert.front.pass.cpp
    R libcxx/test/libcxx/containers/sequences/array/array.zero/assert.subscript.pass.cpp
    M libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp
    A libcxx/test/std/containers/sequences/array/assert.back.pass.cpp
    A libcxx/test/std/containers/sequences/array/assert.front.pass.cpp
    A libcxx/test/std/containers/sequences/array/assert.indexing.pass.cpp
    A libcxx/test/std/containers/sequences/array/assert.iterators.pass.cpp
    M libcxx/utils/libcxx/test/features.py

  Log Message:
  -----------
  [libc++] Add support for bounded iterators in std::array (#110729)

This patch introduces a new kind of bounded iterator that knows the size
of its valid range at compile-time, as in std::array. This allows computing
the end of the range from the start of the range and the size, which requires
storing only the start of the range in the iterator instead of both the start
and the size (or start and end). The iterator wrapper is otherwise identical
in design to the existing __bounded_iter.

Since this requires changing the type of the iterators returned by
std::array, this new bounded iterator is controlled by an ABI flag.

As a drive-by, centralize the tests for std::array::operator[] and add
missing tests for OOB operator[] on non-empty arrays.

Fixes #70864



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