[libcxx] r189039 - Zhihao Yuan noted that there were a few unneeded statements. Eliminated the unnecessary ones, and commented the ones that are there for non-obvious reasons such as to help things limp along in C++03 language mode.

Howard Hinnant hhinnant at apple.com
Thu Aug 22 11:29:50 PDT 2013


Author: hhinnant
Date: Thu Aug 22 13:29:50 2013
New Revision: 189039

URL: http://llvm.org/viewvc/llvm-project?rev=189039&view=rev
Log:
Zhihao Yuan noted that there were a few unneeded  statements.  Eliminated the unnecessary ones, and commented the ones that are there for non-obvious reasons such as to help things limp along in C++03 language mode.

Modified:
    libcxx/trunk/include/__hash_table
    libcxx/trunk/include/__tree
    libcxx/trunk/include/algorithm
    libcxx/trunk/include/ext/hash_map
    libcxx/trunk/include/map
    libcxx/trunk/include/unordered_map

Modified: libcxx/trunk/include/__hash_table
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Thu Aug 22 13:29:50 2013
@@ -2101,7 +2101,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>
     __h.get_deleter().__value_constructed = true;
     __h->__hash_ = __hash;
     __h->__next_ = nullptr;
-    return _VSTD::move(__h);
+    return __h;
 }
 
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -2116,7 +2116,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>
     __h.get_deleter().__value_constructed = true;
     __h->__hash_ = hash_function()(__h->__value_);
     __h->__next_ = nullptr;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -2132,7 +2132,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>
     __h.get_deleter().__value_constructed = true;
     __h->__hash_ = __hash;
     __h->__next_ = nullptr;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 template <class _Tp, class _Hash, class _Equal, class _Alloc>

Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Thu Aug 22 13:29:50 2013
@@ -1854,7 +1854,7 @@ __tree<_Tp, _Compare, _Allocator>::__con
     __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
     __h.get_deleter().__value_constructed = true;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES

Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Thu Aug 22 13:29:50 2013
@@ -829,7 +829,7 @@ for_each(_InputIterator __first, _InputI
 {
     for (; __first != __last; ++__first)
         __f(*__first);
-    return _VSTD::move(__f);
+    return _VSTD::move(__f);  // explicitly moved for (emulated) C++03
 }
 
 // find

Modified: libcxx/trunk/include/ext/hash_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ext/hash_map?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/ext/hash_map (original)
+++ libcxx/trunk/include/ext/hash_map Thu Aug 22 13:29:50 2013
@@ -684,7 +684,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc
     __h.get_deleter().__first_constructed = true;
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
     __h.get_deleter().__second_constructed = true;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>

Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Thu Aug 22 13:29:50 2013
@@ -1266,7 +1266,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__
     __h.get_deleter().__first_constructed = true;
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
     __h.get_deleter().__second_constructed = true;
-    return _VSTD::move(__h);
+    return __h;
 }
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1300,7 +1300,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__
     __h.get_deleter().__first_constructed = true;
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
     __h.get_deleter().__second_constructed = true;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 template <class _Key, class _Tp, class _Compare, class _Allocator>

Modified: libcxx/trunk/include/unordered_map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=189039&r1=189038&r2=189039&view=diff
==============================================================================
--- libcxx/trunk/include/unordered_map (original)
+++ libcxx/trunk/include/unordered_map Thu Aug 22 13:29:50 2013
@@ -1211,7 +1211,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _
     __h.get_deleter().__first_constructed = true;
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
     __h.get_deleter().__second_constructed = true;
-    return _VSTD::move(__h);
+    return __h;
 }
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1258,7 +1258,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _
     __h.get_deleter().__first_constructed = true;
     __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
     __h.get_deleter().__second_constructed = true;
-    return _VSTD::move(__h);
+    return _VSTD::move(__h);  // explicitly moved for C++03
 }
 
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>





More information about the cfe-commits mailing list