From 850bfde4ab4fe5e7d0621f8f6c1b9344ceb89d00 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 28 Jun 2018 12:10:21 +0000 Subject: [PATCH] Revert "ADT: Move ArrayRef comparison operators into the class" This reverts commit r335839, because it breaks the MSVC build. llvm-svn: 335844 --- llvm/include/llvm/ADT/ArrayRef.h | 26 ++++++++++++++++---------- 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 4e97e9c..9cb25b0 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(data, length); } + /// @} + /// @name ArrayRef Comparison Operators + /// @{ + + template + inline bool operator==(ArrayRef LHS, ArrayRef RHS) { + return LHS.equals(RHS); + } + + template + inline bool operator!=(ArrayRef LHS, ArrayRef RHS) { + return !(LHS == RHS); + } + + /// @} + // ArrayRefs can be treated like a POD type. template struct isPodLike; template struct isPodLike> { diff --git a/llvm/unittests/ADT/ArrayRefTest.cpp b/llvm/unittests/ADT/ArrayRefTest.cpp index 7f97c40..e01d212 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 V1{1, 2, 3, 4, 5, 6, 7, 8}; - EXPECT_EQ(AR1, V1); - EXPECT_EQ(V1, AR1); } TEST(ArrayRefTest, EmptyEquals) { -- 2.7.4