[all-commits] [llvm/llvm-project] 276ca8: [libc++] Remove extension to support allocator<con...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Mar 8 12:05:35 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 276ca87382b8f16a65bddac700202924228982f6
      https://github.com/llvm/llvm-project/commit/276ca87382b8f16a65bddac700202924228982f6
  Author: Louis Dionne <ldionne.2 at gmail.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/include/__memory/allocator.h
    M libcxx/include/__memory/shared_ptr.h
    M libcxx/include/memory
    R libcxx/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp
    A libcxx/test/libcxx/memory/allocator.cv.verify.cpp
    M libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp
    R libcxx/test/libcxx/memory/allocator_volatile.verify.cpp
    M libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
    M libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp
    M libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/deduction.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
    M libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp

  Log Message:
  -----------
  [libc++] Remove extension to support allocator<const T>

This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.

This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.

This is a re-application of dbc647643577, which was reverted in 9138666f5
because it broke std::shared_ptr<T const>. Tests have now been added and
we've made sure that std::shared_ptr<T const> wouldn't be broken in this
version.

Differential Revision: https://reviews.llvm.org/D120996




More information about the All-commits mailing list