[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: Re: [PATCH] D11394: Fix warnings about pessimizing return moves for C++11 and higher
From: Dimitry Andric <dimitry () andric ! com>
Date: 2015-07-22 7:07:08
Message-ID: 64827960f27bef97fe73ad41b93d90cb () localhost ! localdomain
[Download RAW message or body]
dim updated this revision to Diff 30324.
dim added a comment.
Used _LIBCPP_HAS_NO_RVALUE_REFERENCES instead of checking __cplusplus.
http://reviews.llvm.org/D11394
Files:
include/__config
include/__hash_table
include/__tree
include/algorithm
include/ext/hash_map
include/map
include/unordered_map
["D11394.30324.patch" (text/x-patch)]
Index: include/unordered_map
===================================================================
--- include/unordered_map
+++ include/unordered_map
@@ -1511,7 +1511,7 @@
__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); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
Index: include/map
===================================================================
--- include/map
+++ include/map
@@ -1523,7 +1523,7 @@
__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); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
Index: include/ext/hash_map
===================================================================
--- include/ext/hash_map
+++ include/ext/hash_map
@@ -681,7 +681,7 @@
__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); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
Index: include/algorithm
===================================================================
--- include/algorithm
+++ include/algorithm
@@ -851,7 +851,7 @@
{
for (; __first != __last; ++__first)
__f(*__first);
- return _VSTD::move(__f); // explicitly moved for (emulated) C++03
+ return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03
}
// find
Index: include/__tree
===================================================================
--- include/__tree
+++ include/__tree
@@ -1843,7 +1843,7 @@
__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); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Index: include/__hash_table
===================================================================
--- include/__hash_table
+++ include/__hash_table
@@ -2108,7 +2108,7 @@
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -2124,7 +2124,7 @@
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -716,6 +716,12 @@
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
+#else
+# define _LIBCPP_EXPLICIT_MOVE(x) (x)
+#endif
+
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
const void *, const void *, const void *, const void *);
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic