[cfe-commits] [libcxx] r122830 - in /libcxx/trunk/include: __split_buffer string type_traits vector

Howard Hinnant hhinnant at apple.com
Tue Jan 4 11:53:31 PST 2011


Author: hhinnant
Date: Tue Jan  4 13:53:31 2011
New Revision: 122830

URL: http://llvm.org/viewvc/llvm-project?rev=122830&view=rev
Log:
Reverting an old optimization that conflicts with the new allocator model, and causes some test casees to compile that shouldn't.

Modified:
    libcxx/trunk/include/__split_buffer
    libcxx/trunk/include/string
    libcxx/trunk/include/type_traits
    libcxx/trunk/include/vector

Modified: libcxx/trunk/include/__split_buffer
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__split_buffer?rev=122830&r1=122829&r2=122830&view=diff
==============================================================================
--- libcxx/trunk/include/__split_buffer (original)
+++ libcxx/trunk/include/__split_buffer Tue Jan  4 13:53:31 2011
@@ -98,11 +98,7 @@
     _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
 
     void __construct_at_end(size_type __n);
-        void __construct_at_end(size_type __n, false_type);
-        void __construct_at_end(size_type __n, true_type);
     void __construct_at_end(size_type __n, const_reference __x);
-        void __construct_at_end(size_type __n, const_reference __x, false_type);
-        void __construct_at_end(size_type __n, const_reference __x, true_type);
     template <class _InputIter>
         typename enable_if
         <
@@ -192,17 +188,9 @@
 //  Precondition:  size() + __n <= capacity()
 //  Postcondition:  size() == size() + __n
 template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
 void
 __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
 {
-    __construct_at_end(__n, __is_zero_default_constructible<value_type>());
-}
-
-template <class _Tp, class _Allocator>
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
-{
     __alloc_rr& __a = this->__alloc();
     do
     {
@@ -212,15 +200,6 @@
     } while (__n > 0);
 }
 
-template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
-{
-    _STD::memset(this->__end_, 0, __n*sizeof(value_type));
-    this->__end_ += __n;
-}
-
 //  Copy constructs __n objects starting at __end_ from __x
 //  throws if construction throws
 //  Precondition:  __n > 0
@@ -228,18 +207,9 @@
 //  Postcondition:  size() == old size() + __n
 //  Postcondition:  [i] == __x for all i in [size() - __n, __n)
 template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
 void
 __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
 {
-    __construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
-                                                         is_trivially_copy_assignable<value_type>::value>());
-}
-
-template <class _Tp, class _Allocator>
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
-{
     __alloc_rr& __a = this->__alloc();
     do
     {
@@ -250,15 +220,6 @@
 }
 
 template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
-void
-__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
-{
-    _STD::fill_n(this->__end_, __n, __x);
-    this->__end_ += __n;
-}
-
-template <class _Tp, class _Allocator>
 template <class _InputIter>
 typename enable_if
 <

Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=122830&r1=122829&r2=122830&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Tue Jan  4 13:53:31 2011
@@ -3641,10 +3641,6 @@
     __lhs.swap(__rhs);
 }
 
-template<class _CharT, class _Traits, class _Allocator>
-struct __is_zero_default_constructible<basic_string<_CharT, _Traits, _Allocator> >
-    : public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
-
 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
 
 typedef basic_string<char16_t> u16string;

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=122830&r1=122829&r2=122830&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Jan  4 13:53:31 2011
@@ -2302,9 +2302,6 @@
 
 #endif  // _LIBCPP_HAS_TYPE_TRAITS
 
-template <class _Tp> struct __is_zero_default_constructible
-    : public integral_constant<bool, is_scalar<_Tp>::value || is_empty<_Tp>::value> {};
-
 template <class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 void

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=122830&r1=122829&r2=122830&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Tue Jan  4 13:53:31 2011
@@ -624,14 +624,8 @@
     void allocate(size_type __n);
     void deallocate();
     _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
-    _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n);
-        void __construct_at_end(size_type __n, false_type);
-    _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, true_type);
-    _LIBCPP_INLINE_VISIBILITY
+    void __construct_at_end(size_type __n);
     void __construct_at_end(size_type __n, const_reference __x);
-    void __construct_at_end(size_type __n, const_reference __x, false_type);
-    _LIBCPP_INLINE_VISIBILITY
-        void __construct_at_end(size_type __n, const_reference __x, true_type);
     template <class _ForwardIterator>
         typename enable_if
         <
@@ -741,17 +735,9 @@
 //  Precondition:  size() + __n <= capacity()
 //  Postcondition:  size() == size() + __n
 template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
 void
 vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
 {
-    __construct_at_end(__n, __is_zero_default_constructible<value_type>());
-}
-
-template <class _Tp, class _Allocator>
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
-{
     allocator_type& __a = this->__alloc();
     do
     {
@@ -761,15 +747,6 @@
     } while (__n > 0);
 }
 
-template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
-{
-    _STD::memset(this->__end_, 0, __n*sizeof(value_type));
-    this->__end_ += __n;
-}
-
 //  Copy constructs __n objects starting at __end_ from __x
 //  throws if construction throws
 //  Precondition:  __n > 0
@@ -781,14 +758,6 @@
 void
 vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
 {
-    __construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
-                                                         is_trivially_copy_assignable<value_type>::value>());
-}
-
-template <class _Tp, class _Allocator>
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
-{
     allocator_type& __a = this->__alloc();
     do
     {
@@ -799,15 +768,6 @@
 }
 
 template <class _Tp, class _Allocator>
-_LIBCPP_INLINE_VISIBILITY inline
-void
-vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
-{
-    _STD::fill_n(this->__end_, __n, __x);
-    this->__end_ += __n;
-}
-
-template <class _Tp, class _Allocator>
 template <class _ForwardIterator>
 typename enable_if
 <
@@ -2765,10 +2725,6 @@
 };
 
 template <class _Tp, class _Allocator>
-struct __is_zero_default_constructible<vector<_Tp, _Allocator> >
-    : public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
-
-template <class _Tp, class _Allocator>
 _LIBCPP_INLINE_VISIBILITY inline
 bool
 operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)





More information about the cfe-commits mailing list