diff options
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-inefficient-algorithm.cpp | 16 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-move-const-arg.cpp | 4 |
2 files changed, 13 insertions, 7 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-inefficient-algorithm.cpp b/clang-tools-extra/test/clang-tidy/misc-inefficient-algorithm.cpp index 75ca7d64738..830c79cabf3 100644 --- a/clang-tools-extra/test/clang-tidy/misc-inefficient-algorithm.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-inefficient-algorithm.cpp @@ -43,19 +43,23 @@ template <typename K, typename V> struct unordered_multimap : map<K, V> {}; template <typename K, typename Cmp = less<K>> struct multiset : set<K, Cmp> {}; -template <typename FwIt, typename K> FwIt find(FwIt, FwIt, const K &); +template <typename FwIt, typename K> +FwIt find(FwIt, FwIt end, const K &) { return end; } template <typename FwIt, typename K, typename Cmp> -FwIt find(FwIt, FwIt, const K &, Cmp); +FwIt find(FwIt, FwIt end, const K &, Cmp) { return end; } -template <typename FwIt, typename Pred> FwIt find_if(FwIt, FwIt, Pred); +template <typename FwIt, typename Pred> +FwIt find_if(FwIt, FwIt end, Pred) { return end; } -template <typename FwIt, typename K> FwIt count(FwIt, FwIt, const K &); +template <typename FwIt, typename K> +unsigned count(FwIt, FwIt, const K &) { return 0; } -template <typename FwIt, typename K> FwIt lower_bound(FwIt, FwIt, const K &); +template <typename FwIt, typename K> +FwIt lower_bound(FwIt, FwIt end, const K &) { return end; } template <typename FwIt, typename K, typename Ord> -FwIt lower_bound(FwIt, FwIt, const K &, Ord); +FwIt lower_bound(FwIt, FwIt end, const K &, Ord) { return end; } } #define FIND_IN_SET(x) find(x.begin(), x.end(), 10) diff --git a/clang-tools-extra/test/clang-tidy/misc-move-const-arg.cpp b/clang-tools-extra/test/clang-tidy/misc-move-const-arg.cpp index 29b2b9214e2..bbe6c6bd865 100644 --- a/clang-tools-extra/test/clang-tidy/misc-move-const-arg.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-move-const-arg.cpp @@ -10,7 +10,9 @@ template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; }; template <typename _Tp> struct remove_reference<_Tp &&> { typedef _Tp type; }; template <typename _Tp> -constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t); +constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) { + return static_cast<typename std::remove_reference<_Tp>::type &&>(__t); +} } // namespace std |