diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-04-12 16:15:53 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-04-12 16:15:53 +0000 |
commit | 15c435a367a80c53c00041e09d997bee4a677e5b (patch) | |
tree | e8d3a3b022a3df02b47c12fca4a7d264143c6c7f /include/llvm/ADT | |
parent | 479151ab7f8a833569701cbd883a4465eeaad33a (diff) | |
download | llvm-15c435a367a80c53c00041e09d997bee4a677e5b.tar.gz llvm-15c435a367a80c53c00041e09d997bee4a677e5b.tar.bz2 llvm-15c435a367a80c53c00041e09d997bee4a677e5b.tar.xz |
Retire llvm::array_endof in favor of non-member std::end.
While there make array_lengthof constexpr if we have support for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/Hashing.h | 3 | ||||
-rw-r--r-- | include/llvm/ADT/STLExtras.h | 12 |
2 files changed, 3 insertions, 12 deletions
diff --git a/include/llvm/ADT/Hashing.h b/include/llvm/ADT/Hashing.h index 4bffd8e6e2..1b84b45675 100644 --- a/include/llvm/ADT/Hashing.h +++ b/include/llvm/ADT/Hashing.h @@ -45,7 +45,6 @@ #ifndef LLVM_ADT_HASHING_H #define LLVM_ADT_HASHING_H -#include "llvm/ADT/STLExtras.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Host.h" #include "llvm/Support/SwapByteOrder.h" @@ -412,7 +411,7 @@ template <typename InputIteratorT> hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT last) { const size_t seed = get_execution_seed(); char buffer[64], *buffer_ptr = buffer; - char *const buffer_end = buffer_ptr + array_lengthof(buffer); + char *const buffer_end = std::end(buffer); while (first != last && store_and_advance(buffer_ptr, buffer_end, get_hashable_data(*first))) ++first; diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index ab6884ffb5..fc45a6645e 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -165,17 +165,9 @@ struct less_second { // Extra additions for arrays //===----------------------------------------------------------------------===// -/// Find where an array ends (for ending iterators) -/// This returns a pointer to the byte immediately -/// after the end of an array. -template<class T, std::size_t N> -inline T *array_endof(T (&x)[N]) { - return x+N; -} - /// Find the length of an array. -template<class T, std::size_t N> -inline size_t array_lengthof(T (&)[N]) { +template <class T, std::size_t N> +LLVM_CONSTEXPR inline size_t array_lengthof(T (&)[N]) { return N; } |