[llvm] r335844 - Revert "ADT: Move ArrayRef comparison operators into the class"
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 05:10:21 PDT 2018
Author: labath
Date: Thu Jun 28 05:10:21 2018
New Revision: 335844
URL: http://llvm.org/viewvc/llvm-project?rev=335844&view=rev
Log:
Revert "ADT: Move ArrayRef comparison operators into the class"
This reverts commit r335839, because it breaks the MSVC build.
Modified:
llvm/trunk/include/llvm/ADT/ArrayRef.h
llvm/trunk/unittests/ADT/ArrayRefTest.cpp
Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=335844&r1=335843&r2=335844&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h Thu Jun 28 05:10:21 2018
@@ -273,16 +273,6 @@ namespace llvm {
}
/// @}
- /// @name Comparison operators
- /// @{
-
- friend bool operator==(ArrayRef LHS, ArrayRef RHS) {
- return LHS.equals(RHS);
- }
-
- friend bool operator!=(ArrayRef LHS, ArrayRef RHS) { return !(LHS == RHS); }
-
- /// @}
};
/// MutableArrayRef - Represent a mutable reference to an array (0 or more
@@ -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>> {
Modified: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ArrayRefTest.cpp?rev=335844&r1=335843&r2=335844&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ArrayRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp Thu Jun 28 05:10:21 2018
@@ -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) {
More information about the llvm-commits
mailing list