[libcxx] r347783 - [libcxx] Remove dynarray

Louis Dionne ldionne at apple.com
Wed Nov 28 10:02:00 PST 2018


Author: ldionne
Date: Wed Nov 28 10:02:00 2018
New Revision: 347783

URL: http://llvm.org/viewvc/llvm-project?rev=347783&view=rev
Log:
[libcxx] Remove dynarray

Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

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

Removed:
    libcxx/trunk/include/experimental/dynarray
    libcxx/trunk/test/libcxx/experimental/containers/
Modified:
    libcxx/trunk/docs/ReleaseNotes.rst
    libcxx/trunk/include/CMakeLists.txt
    libcxx/trunk/include/__config
    libcxx/trunk/include/module.modulemap
    libcxx/trunk/test/libcxx/double_include.sh.cpp
    libcxx/trunk/test/libcxx/min_max_macros.sh.cpp

Modified: libcxx/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/ReleaseNotes.rst?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/docs/ReleaseNotes.rst (original)
+++ libcxx/trunk/docs/ReleaseNotes.rst Wed Nov 28 10:02:00 2018
@@ -48,3 +48,7 @@ API Changes
   linking translation units built with different versions of libc++'s headers
   together may lead to ODR violations and ABI issues. On the flipside, code
   size improvements should be expected for everyone not defining the macro.
+- Starting with LLVM 8.0.0, std::dynarray has been removed from the library.
+  std::dynarray was a feature proposed for C++14 that was pulled from the
+  Standard at the last minute and was never standardized. Since there are no
+  plans to standardize this facility it is being removed.

Modified: libcxx/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Wed Nov 28 10:02:00 2018
@@ -69,7 +69,6 @@ set(files
   experimental/chrono
   experimental/coroutine
   experimental/deque
-  experimental/dynarray
   experimental/filesystem
   experimental/forward_list
   experimental/functional

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Nov 28 10:02:00 2018
@@ -1350,13 +1350,11 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 
 // Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
 #ifdef _LIBCPP_NO_EXCEPTIONS
-#  define _LIBCPP_AVAILABILITY_DYNARRAY
 #  define _LIBCPP_AVAILABILITY_FUTURE
 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
 #  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
 #else
-#  define _LIBCPP_AVAILABILITY_DYNARRAY                  _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
 #  define _LIBCPP_AVAILABILITY_FUTURE                    _LIBCPP_AVAILABILITY_FUTURE_ERROR
 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST        _LIBCPP_AVAILABILITY_BAD_ANY_CAST
 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS

Removed: libcxx/trunk/include/experimental/dynarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=347782&view=auto
==============================================================================
--- libcxx/trunk/include/experimental/dynarray (original)
+++ libcxx/trunk/include/experimental/dynarray (removed)
@@ -1,305 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- dynarray ----------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_DYNARRAY
-#define _LIBCPP_DYNARRAY
-
-/*
-    dynarray synopsis
-
-namespace std { namespace experimental {
-
-template< typename T >
-class dynarray
-{
-    // types:
-    typedef       T                               value_type;
-    typedef       T&                              reference;
-    typedef const T&                              const_reference;
-    typedef       T*                              pointer;
-    typedef const T*                              const_pointer;
-    typedef       implementation-defined          iterator;
-    typedef       implementation-defined          const_iterator;
-    typedef reverse_iterator<iterator>            reverse_iterator;
-    typedef reverse_iterator<const_iterator>      const_reverse_iterator;
-    typedef size_t                                size_type;
-    typedef ptrdiff_t                             difference_type;
-
-public:
-    // construct/copy/destroy:
-    explicit dynarray(size_type c);
-    dynarray(size_type c, const T& v);
-    dynarray(const dynarray& d);
-    dynarray(initializer_list<T>);
-
-    template <class Alloc>
-      dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc);
-    template <class Alloc>
-      dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc);
-    template <class Alloc>
-      dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc);
-    template <class Alloc>
-      dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc);
-    dynarray& operator=(const dynarray&) = delete;
-    ~dynarray();
-
-    // iterators:
-    iterator       begin()        noexcept;
-    const_iterator begin()  const noexcept;
-    const_iterator cbegin() const noexcept;
-    iterator       end()          noexcept;
-    const_iterator end()    const noexcept;
-    const_iterator cend()   const noexcept;
-
-    reverse_iterator       rbegin()        noexcept;
-    const_reverse_iterator rbegin()  const noexcept;
-    const_reverse_iterator crbegin() const noexcept;
-    reverse_iterator       rend()          noexcept;
-    const_reverse_iterator rend()    const noexcept;
-    const_reverse_iterator crend()   const noexcept;
-
-    // capacity:
-    size_type size()     const noexcept;
-    size_type max_size() const noexcept;
-    bool      empty()    const noexcept;
-
-    // element access:
-    reference       operator[](size_type n);
-    const_reference operator[](size_type n) const;
-
-    reference       front();
-    const_reference front() const;
-    reference       back();
-    const_reference back()  const;
-
-    const_reference at(size_type n) const;
-    reference       at(size_type n);
-
-    // data access:
-    T*       data()       noexcept;
-    const T* data() const noexcept;
-
-    // mutating member functions:
-    void fill(const T& v);
-};
-
-}}  // std::experimental
-
-*/
-#include <__config>
-#if _LIBCPP_STD_VER > 11
-
-#include <__functional_base>
-#include <iterator>
-#include <stdexcept>
-#include <initializer_list>
-#include <new>
-#include <algorithm>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-namespace std { namespace experimental { inline namespace __array_extensions_v1 {
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray
-{
-public:
-    // types:
-    typedef dynarray __self;
-    typedef _Tp                                   value_type;
-    typedef value_type&                           reference;
-    typedef const value_type&                     const_reference;
-    typedef value_type*                           iterator;
-    typedef const value_type*                     const_iterator;
-    typedef value_type*                           pointer;
-    typedef const value_type*                     const_pointer;
-    typedef size_t                                size_type;
-    typedef ptrdiff_t                             difference_type;
-    typedef std::reverse_iterator<iterator>       reverse_iterator;
-    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
-private:
-    size_t                  __size_;
-    value_type *            __base_;
-    _LIBCPP_INLINE_VISIBILITY dynarray () noexcept :  __size_(0), __base_(nullptr) {}
-    
-    static inline _LIBCPP_INLINE_VISIBILITY
-    value_type* __allocate(size_t __count) {
-        if (numeric_limits<size_t>::max() / sizeof (value_type) <= __count)
-            __throw_bad_array_length();
-
-        return static_cast<value_type *>(
-            _VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type)));
-    }
-
-    static inline _LIBCPP_INLINE_VISIBILITY
-    void __deallocate_value(value_type* __ptr, size_t __count) noexcept {
-        _VSTD::__libcpp_deallocate(static_cast<void *>(__ptr), sizeof(value_type) * __count, __alignof(value_type));
-    }
-
-public:
-
-    _LIBCPP_INLINE_VISIBILITY
-    explicit dynarray(size_type __c);
-    _LIBCPP_INLINE_VISIBILITY
-    dynarray(size_type __c, const value_type& __v);
-    _LIBCPP_INLINE_VISIBILITY
-    dynarray(const dynarray& __d);
-    _LIBCPP_INLINE_VISIBILITY
-    dynarray(initializer_list<value_type>);
-
-//  We're not implementing these right now.
-//  Updated with the resolution of LWG issue #2255
-//     template <typename _Alloc>
-//       dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c);
-//     template <typename _Alloc>
-//       dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v);
-//     template <typename _Alloc>
-//       dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d);
-//     template <typename _Alloc>
-//       dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>);
-
-    dynarray& operator=(const dynarray&) = delete;
-    _LIBCPP_INLINE_VISIBILITY
-    ~dynarray();
-
-    // iterators:
-    inline _LIBCPP_INLINE_VISIBILITY iterator       begin()        noexcept { return iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator begin()  const noexcept { return const_iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY iterator       end()          noexcept { return iterator(data() + __size_); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator end()    const noexcept { return const_iterator(data() + __size_); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator cend()   const noexcept { return const_iterator(data() + __size_); }
-
-    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rbegin()        noexcept { return reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin()  const noexcept { return const_reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rend()          noexcept { return reverse_iterator(begin()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend()    const noexcept { return const_reverse_iterator(begin()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend()   const noexcept { return const_reverse_iterator(begin()); }
-
-    // capacity:
-    inline _LIBCPP_INLINE_VISIBILITY size_type size()     const noexcept { return __size_; }
-    inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
-    inline _LIBCPP_INLINE_VISIBILITY bool      empty()    const noexcept { return __size_ == 0; }
-
-    // element access:
-    inline _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n)       { return data()[__n]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
-
-    inline _LIBCPP_INLINE_VISIBILITY reference       front()       { return data()[0]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
-    inline _LIBCPP_INLINE_VISIBILITY reference       back()        { return data()[__size_-1]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference back()  const { return data()[__size_-1]; }
-
-    inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
-    inline _LIBCPP_INLINE_VISIBILITY reference       at(size_type __n);
-
-    // data access:
-    inline _LIBCPP_INLINE_VISIBILITY _Tp*       data()       noexcept { return __base_; }
-    inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
-
-    // mutating member functions:
-    inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
-};
-
-template <class _Tp>
-inline
-dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
-{
-    __base_ = __allocate (__c);
-    value_type *__data = data ();
-    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
-        ::new (__data) value_type;
-}
-
-template <class _Tp>
-inline
-dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
-{
-    __base_ = __allocate (__c);
-    value_type *__data = data ();
-    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
-        ::new (__data) value_type (__v);
-}
-
-template <class _Tp>
-inline
-dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
-{
-    size_t sz = __il.size();
-    __base_ = __allocate (sz);
-    value_type *__data = data ();
-    auto src = __il.begin();
-    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
-        ::new (__data) value_type (*src);
-}
-
-template <class _Tp>
-inline
-dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
-{
-    size_t sz = __d.size();
-    __base_ = __allocate (sz);
-    value_type *__data = data ();
-    auto src = __d.begin();
-    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
-        ::new (__data) value_type (*src);
-}
-
-template <class _Tp>
-inline
-dynarray<_Tp>::~dynarray()
-{ 
-    value_type *__data = data () + __size_;
-    for ( size_t i = 0; i < __size_; ++i )
-        (--__data)->value_type::~value_type();
-    __deallocate_value(__base_, __size_);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename dynarray<_Tp>::reference
-dynarray<_Tp>::at(size_type __n)
-{
-    if (__n >= __size_)
-        __throw_out_of_range("dynarray::at");
-
-    return data()[__n];
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename dynarray<_Tp>::const_reference
-dynarray<_Tp>::at(size_type __n) const
-{
-    if (__n >= __size_)
-        __throw_out_of_range("dynarray::at");
-
-    return data()[__n];
-}
-
-}}}
-
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif  // if _LIBCPP_STD_VER > 11 
-#endif  // _LIBCPP_DYNARRAY

Modified: libcxx/trunk/include/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/include/module.modulemap (original)
+++ libcxx/trunk/include/module.modulemap Wed Nov 28 10:02:00 2018
@@ -524,10 +524,6 @@ module std [system] {
       header "experimental/deque"
       export *
     }
-    module dynarray {
-      header "experimental/dynarray"
-      export *
-    }
     module filesystem {
       header "experimental/filesystem"
       export *

Modified: libcxx/trunk/test/libcxx/double_include.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/double_include.sh.cpp (original)
+++ libcxx/trunk/test/libcxx/double_include.sh.cpp Wed Nov 28 10:02:00 2018
@@ -145,7 +145,6 @@
 #include <experimental/coroutine>
 #endif
 #include <experimental/deque>
-#include <experimental/dynarray>
 #include <experimental/filesystem>
 #include <experimental/forward_list>
 #include <experimental/functional>

Modified: libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/min_max_macros.sh.cpp?rev=347783&r1=347782&r2=347783&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/min_max_macros.sh.cpp (original)
+++ libcxx/trunk/test/libcxx/min_max_macros.sh.cpp Wed Nov 28 10:02:00 2018
@@ -241,8 +241,6 @@ TEST_MACROS();
 TEST_MACROS();
 #include <experimental/deque>
 TEST_MACROS();
-#include <experimental/dynarray>
-TEST_MACROS();
 #include <experimental/filesystem>
 TEST_MACROS();
 #include <experimental/forward_list>




More information about the libcxx-commits mailing list