[gardening] Remove unneeded implementations of none_of/count_if/count.

These are now provided upstream by LLVM.
This commit is contained in:
Michael Gottesman
2016-12-04 02:53:54 -08:00
parent cd7929e84d
commit 35edd1364a
2 changed files with 3 additions and 28 deletions

View File

@@ -38,6 +38,7 @@
#include <utility> #include <utility>
#include "llvm/ADT/iterator_range.h" #include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
namespace swift { namespace swift {
using llvm::make_range; using llvm::make_range;
@@ -268,33 +269,6 @@ template <class T> EnumeratorRange<T> enumerate(T Begin, T End) {
return EnumeratorRange<T>(Begin, End); return EnumeratorRange<T>(Begin, End);
} }
/// An adaptor of std::none_of for ranges.
template <class Range, class Predicate>
inline bool none_of(const Range &R, Predicate &&P) {
return std::none_of(R.begin(), R.end(), std::forward<Predicate>(P));
}
/// An adaptor of std::count for ranges.
///
/// We use std::result_of on Range::begin since llvm::iterator_range does not
/// have a public typedef set to what is the underlying iterator.
//typename std::iterator_traits<decltype(&Range::begin())>::difference_type
template <class Range, class Value>
inline auto count(const Range &R, Value V)
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
return std::count(R.begin(), R.end(), V);
}
/// An adaptor of std::count_if for ranges.
///
/// We use std::result_of on Range::begin since llvm::iterator_range does not
/// have a public typedef set to what is the underlying iterator.
template <class Range, class Predicate>
inline auto count_if(const Range &R, Predicate &&P)
-> typename std::iterator_traits<decltype(R.begin())>::difference_type {
return std::count_if(R.begin(), R.end(), std::forward<Predicate>(P));
}
} // end namespace swift } // end namespace swift
#endif // SWIFT_BASIC_RANGE_H #endif // SWIFT_BASIC_RANGE_H

View File

@@ -17,6 +17,7 @@
#include "llvm/ADT/Optional.h" #include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <map> #include <map>
@@ -254,7 +255,7 @@ bool CtorTesterSet::hasLiveTesters() const {
} }
bool CtorTesterSet::numLiveTesters() const { bool CtorTesterSet::numLiveTesters() const {
return count_if(Constructed, [](CtorTester *T) -> bool { return llvm::count_if(Constructed, [](CtorTester *T) -> bool {
assert(T); assert(T);
return !T->isIgnorableTester(); return !T->isIgnorableTester();
}); });