Revert "ADT: Move ArrayRef comparison operators into the class"

This reverts commit r335839, because it breaks the MSVC build.

llvm-svn: 335844
This commit is contained in:
Pavel Labath 2018-06-28 12:10:21 +00:00
parent 0050466976
commit 850bfde4ab
2 changed files with 16 additions and 14 deletions

View File

@ -272,16 +272,6 @@ namespace llvm {
return std::vector<T>(Data, Data+Length);
}
/// @}
/// @name Comparison operators
/// @{
friend bool operator==(ArrayRef LHS, ArrayRef RHS) {
return LHS.equals(RHS);
}
friend bool operator!=(ArrayRef LHS, ArrayRef RHS) { return !(LHS == RHS); }
/// @}
};
@ -520,6 +510,22 @@ namespace llvm {
return MutableArrayRef<T>(data, length);
}
/// @}
/// @name ArrayRef Comparison Operators
/// @{
template<typename T>
inline bool operator==(ArrayRef<T> LHS, ArrayRef<T> RHS) {
return LHS.equals(RHS);
}
template<typename T>
inline bool operator!=(ArrayRef<T> LHS, ArrayRef<T> RHS) {
return !(LHS == RHS);
}
/// @}
// ArrayRefs can be treated like a POD type.
template <typename T> struct isPodLike;
template <typename T> struct isPodLike<ArrayRef<T>> {

View File

@ -188,10 +188,6 @@ TEST(ArrayRefTest, Equals) {
EXPECT_TRUE(AR1b.equals({3, 4, 5, 6}));
EXPECT_FALSE(AR1b.equals({2, 3, 4, 5, 6}));
EXPECT_FALSE(AR1b.equals({3, 4, 5, 6, 7}));
SmallVector<int, 8> V1{1, 2, 3, 4, 5, 6, 7, 8};
EXPECT_EQ(AR1, V1);
EXPECT_EQ(V1, AR1);
}
TEST(ArrayRefTest, EmptyEquals) {