[llvm-commits] [llvm-gcc-4.2] r75248 - in /llvm-gcc-4.2/trunk/libstdc++-v3/include/bits: stl_bvector.h stl_deque.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h stl_set.h stl_tree.h stl_vector.h

Rafael Espindola rafael.espindola at gmail.com
Fri Jul 10 05:44:35 PDT 2009


Author: rafael
Date: Fri Jul 10 07:44:34 2009
New Revision: 75248

URL: http://llvm.org/viewvc/llvm-project?rev=75248&view=rev
Log:
backport part of
http://gcc.gnu.org/ml/gcc-cvs/2007-10/msg00118.html

The patch is for libstdc++ and it was GPL2 at the time.

With this patch llvm-gcc now compiles

---------------------------------------------------
     #include <set>

     class A {
     public:
       A();
       private:
       A(const A&);
     };
     void B()
     {
       std::set<void *, A> foo;
     }
-------------------------------------------------


Modified:
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_bvector.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_deque.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_list.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_map.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multimap.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multiset.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_set.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_tree.h
    llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_vector.h

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_bvector.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_bvector.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_bvector.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_bvector.h Fri Jul 10 07:44:34 2009
@@ -385,6 +385,13 @@
 	_Bit_iterator 	_M_start;
 	_Bit_iterator 	_M_finish;
 	_Bit_type* 	_M_end_of_storage;
+
+        // LLVM LOCAL begin mainline 129013
+	_Bvector_impl()
+	: _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0)
+	{ }
+        // LLVM LOCAL end mainline 129013
+
 	_Bvector_impl(const _Bit_alloc_type& __a)
 	: _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
 	{ }
@@ -405,7 +412,13 @@
       get_allocator() const
       { return allocator_type(_M_get_Bit_allocator()); }
 
-      _Bvector_base(const allocator_type& __a) : _M_impl(__a) { }
+      // LLVM LOCAL begin mainline 129013
+      _Bvector_base()
+      : _M_impl() { }
+
+      _Bvector_base(const allocator_type& __a)
+      : _M_impl(__a) { }
+      // LLVM LOCAL end mainline 129013
 
       ~_Bvector_base()
       { this->_M_deallocate(); }
@@ -480,8 +493,15 @@
     using _Base::_M_get_Bit_allocator;
 
   public:
+    // LLVM LOCAL begin mainline 129013
+    vector()
+    : _Base() { }
+    // LLVM LOCAL end mainline 129013
+
     explicit
-    vector(const allocator_type& __a = allocator_type())
+    // LLVM LOCAL begin mainline 129013
+    vector(const allocator_type& __a)
+    // LLVM LOCAL end mainline 129013
     : _Base(__a) { }
 
     explicit
@@ -678,7 +698,9 @@
     }
 
     void
-    swap(vector<bool, _Alloc>& __x)
+    // LLVM LOCAL begin mainline 129013
+    swap(vector& __x)
+    // LLVM LOCAL end mainline 129013
     {
       std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
       std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_deque.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_deque.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_deque.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_deque.h Fri Jul 10 07:44:34 2009
@@ -380,6 +380,12 @@
       typedef _Deque_iterator<_Tp, _Tp&, _Tp*>             iterator;
       typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
 
+      // LLVM LOCAL begin mainline 129013
+      _Deque_base()
+      : _M_impl()
+      { _M_initialize_map(0); }
+      // LLVM LOCAL end mainline 129013
+
       _Deque_base(const allocator_type& __a, size_t __num_elements)
       : _M_impl(__a)
       { _M_initialize_map(__num_elements); }
@@ -406,6 +412,13 @@
 	iterator _M_start;
 	iterator _M_finish;
 
+        // LLVM LOCAL start mainline 129013
+	_Deque_impl()
+	: _Tp_alloc_type(), _M_map(0), _M_map_size(0),
+	  _M_start(), _M_finish()
+	{ }
+        // LLVM LOCAL end mainline 129013
+
 	_Deque_impl(const _Tp_alloc_type& __a)
 	: _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),
 	  _M_start(), _M_finish()
@@ -679,8 +692,15 @@
       /**
        *  @brief  Default constructor creates no elements.
        */
+      // LLVM LOCAL begin mainline 129013
+      deque()
+      : _Base() { }
+      // LLVM LOCAL end mainline 129013
+
       explicit
-      deque(const allocator_type& __a = allocator_type())
+      // LLVM LOCAL begin mainline 129013
+      deque(const allocator_type& __a)
+      // LLVM LOCAL end mainline 129013
       : _Base(__a, 0) {}
 
       /**

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_list.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_list.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_list.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_list.h Fri Jul 10 07:44:34 2009
@@ -305,6 +305,12 @@
       {
 	_List_node_base _M_node;
 
+        // LLVM LOCAL begin mainline 129013
+	_List_impl()
+	: _Node_alloc_type(), _M_node()
+	{ }
+        // LLVM LOCAL end mainline 129013
+
 	_List_impl(const _Node_alloc_type& __a)
 	: _Node_alloc_type(__a), _M_node()
 	{ }
@@ -339,6 +345,12 @@
       get_allocator() const
       { return allocator_type(_M_get_Node_allocator()); }
 
+        // LLVM LOCAL begin mainline 129013
+      _List_base()
+      : _M_impl()
+      { _M_init(); }
+        // LLVM LOCAL end mainline 129013
+
       _List_base(const allocator_type& __a)
       : _M_impl(__a)
       { _M_init(); }
@@ -468,8 +480,15 @@
       /**
        *  @brief  Default constructor creates no elements.
        */
+      // LLVM LOCAL begin mainline 129013
+      list()
+      : _Base() { }
+      // LLVM LOCAL end mainline 129013
+
       explicit
-      list(const allocator_type& __a = allocator_type())
+      // LLVM LOCAL begin mainline 129013
+      list(const allocator_type& __a)
+      // LLVM LOCAL end mainline 129013
       : _Base(__a) { }
 
       /**

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_map.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_map.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_map.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_map.h Fri Jul 10 07:44:34 2009
@@ -155,7 +155,9 @@
        *  @brief  Default constructor creates no elements.
        */
       map()
-      : _M_t(_Compare(), allocator_type()) { }
+      // LLVM LOCAL begin mainline 129013
+      : _M_t() { }
+      // LLVM LOCAL end mainline 129013
 
       // for some reason this was made a separate function
       /**
@@ -186,7 +188,9 @@
        */
       template <typename _InputIterator>
         map(_InputIterator __first, _InputIterator __last)
-	: _M_t(_Compare(), allocator_type())
+        // LLVM LOCAL begin mainline 129013
+	: _M_t()
+        // LLVM LOCAL end mainline 129013
         { _M_t._M_insert_unique(__first, __last); }
 
       /**

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multimap.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_multimap.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multimap.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multimap.h Fri Jul 10 07:44:34 2009
@@ -152,7 +152,9 @@
        *  @brief  Default constructor creates no elements.
        */
       multimap()
-      : _M_t(_Compare(), allocator_type()) { }
+      // LLVM LOCAL begin mainline 129013
+      : _M_t() { }
+      // LLVM LOCAL end mainline 129013
 
       // for some reason this was made a separate function
       /**
@@ -184,8 +186,10 @@
        */
       template <typename _InputIterator>
         multimap(_InputIterator __first, _InputIterator __last)
-	: _M_t(_Compare(), allocator_type())
-        { _M_t._M_insert_equal(__first, __last); }
+        // LLVM LOCAL begin mainline 129013
+	: _M_t()
+        { _M_t._M_insert_unique(__first, __last); }
+        // LLVM LOCAL end mainline 129013
 
       /**
        *  @brief  Builds a %multimap from a range.

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multiset.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_multiset.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multiset.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_multiset.h Fri Jul 10 07:44:34 2009
@@ -134,7 +134,9 @@
        *  @brief  Default constructor creates no elements.
        */
       multiset()
-      : _M_t(_Compare(), allocator_type()) { }
+      // LLVM LOCAL begin mainline 129013
+      : _M_t() { }
+      // LLVM LOCAL end mainline 129013
 
       explicit
       multiset(const _Compare& __comp,
@@ -152,7 +154,9 @@
        */
       template <class _InputIterator>
         multiset(_InputIterator __first, _InputIterator __last)
-	: _M_t(_Compare(), allocator_type())
+        // LLVM LOCAL begin mainline 129013
+	: _M_t()
+        // LLVM LOCAL end mainline 129013
         { _M_t._M_insert_equal(__first, __last); }
 
       /**
@@ -180,7 +184,9 @@
        *  The newly-created %multiset uses a copy of the allocation object used
        *  by @a x.
        */
-      multiset(const multiset<_Key,_Compare,_Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      multiset(const multiset& __x)
+      // LLVM LOCAL end mainline 129013
       : _M_t(__x._M_t) { }
 
       /**
@@ -190,8 +196,10 @@
        *  All the elements of @a x are copied, but unlike the copy constructor,
        *  the allocator object is not copied.
        */
-      multiset<_Key,_Compare,_Alloc>&
-      operator=(const multiset<_Key,_Compare,_Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      multiset&
+      operator=(const multiset& __x)
+      // LLVM LOCAL end mainline 129013
       {
 	_M_t = __x._M_t;
 	return *this;
@@ -275,7 +283,9 @@
        *  std::swap(s1,s2) will feed to this function.
        */
       void
-      swap(multiset<_Key, _Compare, _Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      swap(multiset& __x)
+      // LLVM LOCAL end mainline 129013
       { _M_t.swap(__x._M_t); }
 
       // insert/erase

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_set.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_set.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_set.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_set.h Fri Jul 10 07:44:34 2009
@@ -138,7 +138,9 @@
       // allocation/deallocation
       ///  Default constructor creates no elements.
       set()
-      : _M_t(_Compare(), allocator_type()) {}
+      // LLVM LOCAL begin mainline 129013
+      : _M_t() { }
+      // LLVM LOCAL end mainline 129013
 
       /**
        *  @brief  Default constructor creates no elements.
@@ -162,7 +164,9 @@
        */
       template<class _InputIterator>
         set(_InputIterator __first, _InputIterator __last)
-        : _M_t(_Compare(), allocator_type())
+        // LLVM LOCAL begin mainline 129013
+        : _M_t()
+        // LLVM LOCAL end mainline 129013
         { _M_t._M_insert_unique(__first, __last); }
 
       /**
@@ -190,7 +194,9 @@
        *  The newly-created %set uses a copy of the allocation object used
        *  by @a x.
        */
-      set(const set<_Key,_Compare,_Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      set(const set& __x)
+      // LLVM LOCAL end mainline 129013
       : _M_t(__x._M_t) { }
 
       /**
@@ -200,8 +206,10 @@
        *  All the elements of @a x are copied, but unlike the copy constructor,
        *  the allocator object is not copied.
        */
-      set<_Key,_Compare,_Alloc>&
-      operator=(const set<_Key, _Compare, _Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      set&
+      operator=(const set& __x)
+      // LLVM LOCAL end mainline 129013
       {
 	_M_t = __x._M_t;
 	return *this;
@@ -283,7 +291,9 @@
        *  std::swap(s1,s2) will feed to this function.
        */
       void
-      swap(set<_Key,_Compare,_Alloc>& __x)
+      // LLVM LOCAL begin mainline 129013
+      swap(set& __x)
+      // LLVM LOCAL end mainline 129013
       { _M_t.swap(__x._M_t); }
 
       // insert/erase

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_tree.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_tree.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_tree.h Fri Jul 10 07:44:34 2009
@@ -410,10 +410,21 @@
 	  _Rb_tree_node_base 	_M_header;
 	  size_type 		_M_node_count; // Keeps track of size of tree.
 
-	  _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),
-			const _Key_compare& __comp = _Key_compare())
-	  : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), 
+          // LLVM LOCAL begin mainline 129013
+	  _Rb_tree_impl()
+	  : _Node_allocator(), _M_key_compare(), _M_header(),
 	    _M_node_count(0)
+	  { _M_initialize(); }
+
+	  _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
+	  : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
+	    _M_node_count(0)
+	  { _M_initialize(); }
+
+	private:
+	  void
+	  _M_initialize()
+          // LLVM LOCAL end mainline 129013
 	  {
 	    this->_M_header._M_color = _S_red;
 	    this->_M_header._M_parent = 0;
@@ -431,11 +442,22 @@
 	  _Rb_tree_node_base 	_M_header;
 	  size_type 		_M_node_count; // Keeps track of size of tree.
 
-	  _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),
-			const _Key_compare& __comp = _Key_compare())
+          // LLVM LOCAL begin mainline 129013
+	  _Rb_tree_impl()
+	  : _Node_allocator(), _M_key_compare(), _M_header(),
+	    _M_node_count(0)
+	  { _M_initialize(); }
+
+	  _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
 	  : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
 	    _M_node_count(0)
-	  { 
+	  { _M_initialize(); }
+
+	private:
+	  void
+	  _M_initialize()
+          // LLVM LOCAL end mainline 129013
+	  {
 	    this->_M_header._M_color = _S_red;
 	    this->_M_header._M_parent = 0;
 	    this->_M_header._M_left = &this->_M_header;
@@ -568,16 +590,15 @@
       _Rb_tree()
       { }
 
-      _Rb_tree(const _Compare& __comp)
-      : _M_impl(allocator_type(), __comp)
-      { }
-
-      _Rb_tree(const _Compare& __comp, const allocator_type& __a)
-      : _M_impl(__a, __comp)
+      // LLVM LOCAL begin mainline 129013
+      _Rb_tree(const _Compare& __comp,
+	       const allocator_type& __a = allocator_type())
+      : _M_impl(__comp, __a)
       { }
 
-      _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
-      : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare)
+      _Rb_tree(const _Rb_tree& __x)
+      : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
+      // LLVM LOCAL end mainline 129013
       {
 	if (__x._M_root() != 0)
 	  {
@@ -591,8 +612,10 @@
       ~_Rb_tree()
       { _M_erase(_M_begin()); }
 
-      _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
-      operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x);
+      // LLVM LOCAL begin mainline 129013
+      _Rb_tree&
+      operator=(const _Rb_tree& __x);
+      // LLVM LOCAL end mainline 129013
 
       // Accessors.
       _Compare
@@ -652,8 +675,10 @@
       max_size() const
       { return get_allocator().max_size(); }
 
+      // LLVM LOCAL begin mainline 129013
       void
-      swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
+      swap(_Rb_tree& __t);
+      // LLVM LOCAL end mainline 129013
 
       // Insert/erase.
       pair<iterator, bool>

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_vector.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/include/bits/stl_vector.h?rev=75248&r1=75247&r2=75248&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_vector.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/include/bits/stl_vector.h Fri Jul 10 07:44:34 2009
@@ -84,6 +84,13 @@
 	_Tp*           _M_start;
 	_Tp*           _M_finish;
 	_Tp*           _M_end_of_storage;
+
+        // LLVM LOCAL begin mainline 129013
+	_Vector_impl()
+	: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
+	{ }
+        // LLVM LOCAL end mainline 129013
+
 	_Vector_impl(_Tp_alloc_type const& __a)
 	: _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
 	{ }
@@ -104,6 +111,11 @@
       get_allocator() const
       { return allocator_type(_M_get_Tp_allocator()); }
 
+      // LLVM LOCAL begin mainline 129013
+      _Vector_base()
+      : _M_impl() { }
+      // LLVM LOCAL end mainline 129013
+
       _Vector_base(const allocator_type& __a)
       : _M_impl(__a)
       { }
@@ -194,8 +206,15 @@
       /**
        *  @brief  Default constructor creates no elements.
        */
+      // LLVM LOCAL begin mainline 129013
+      vector()
+      : _Base() { }
+      // LLVM LOCAL end mainline 129013
+
       explicit
-      vector(const allocator_type& __a = allocator_type())
+      // LLVM LOCAL begin mainline 129013
+      vector(const allocator_type& __a)
+      // LLVM LOCAL end mainline 129013
       : _Base(__a)
       { }
 





More information about the llvm-commits mailing list