diff options
| author | Pavel Labath <labath@google.com> | 2018-06-28 12:10:21 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2018-06-28 12:10:21 +0000 |
| commit | 850bfde4ab4fe5e7d0621f8f6c1b9344ceb89d00 (patch) | |
| tree | 2c953fe734951542980da9b94802e0ed1fb8af4b | |
| parent | 0050466976e78959bec3201dbfcc8898869f2827 (diff) | |
| download | bcm5719-llvm-850bfde4ab4fe5e7d0621f8f6c1b9344ceb89d00.tar.gz bcm5719-llvm-850bfde4ab4fe5e7d0621f8f6c1b9344ceb89d00.zip | |
Revert "ADT: Move ArrayRef comparison operators into the class"
This reverts commit r335839, because it breaks the MSVC build.
llvm-svn: 335844
| -rw-r--r-- | llvm/include/llvm/ADT/ArrayRef.h | 26 | ||||
| -rw-r--r-- | llvm/unittests/ADT/ArrayRefTest.cpp | 4 |
2 files changed, 16 insertions, 14 deletions
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index 4e97e9ca2de..9cb25b09c6c 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -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>> { diff --git a/llvm/unittests/ADT/ArrayRefTest.cpp b/llvm/unittests/ADT/ArrayRefTest.cpp index 7f97c40d41c..e01d212f218 100644 --- a/llvm/unittests/ADT/ArrayRefTest.cpp +++ b/llvm/unittests/ADT/ArrayRefTest.cpp @@ -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) { |

