[llvm] r244835 - Simplify PackedVector by removing user-defined special members that aren't any different than the defaults

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 16:26:12 PDT 2015


Author: dblaikie
Date: Wed Aug 12 18:26:12 2015
New Revision: 244835

URL: http://llvm.org/viewvc/llvm-project?rev=244835&view=rev
Log:
Simplify PackedVector by removing user-defined special members that aren't any different than the defaults

This causes the other special members (like move and copy construction,
and move assignment) to come through for free. Some code in clang was
depending on the (deprecated, in the original code) copy ctor. Now that
there's no user-defined special members, they're all available without
any deprecation concerns.

Modified:
    llvm/trunk/include/llvm/ADT/PackedVector.h
    llvm/trunk/unittests/ADT/PackedVectorTest.cpp

Modified: llvm/trunk/include/llvm/ADT/PackedVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PackedVector.h?rev=244835&r1=244834&r2=244835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PackedVector.h (original)
+++ llvm/trunk/include/llvm/ADT/PackedVector.h Wed Aug 12 18:26:12 2015
@@ -96,7 +96,7 @@ public:
     }
   };
 
-  PackedVector() { }
+  PackedVector() = default;
   explicit PackedVector(unsigned size) : Bits(size << (BitNum-1)) { }
 
   bool empty() const { return Bits.empty(); }
@@ -135,19 +135,10 @@ public:
     return Bits != RHS.Bits;
   }
 
-  const PackedVector &operator=(const PackedVector &RHS) {
-    Bits = RHS.Bits;
-    return *this;
-  }
-
   PackedVector &operator|=(const PackedVector &RHS) {
     Bits |= RHS.Bits;
     return *this;
   }
-
-  void swap(PackedVector &RHS) {
-    Bits.swap(RHS.Bits);
-  }
 };
 
 // Leave BitNum=0 undefined.

Modified: llvm/trunk/unittests/ADT/PackedVectorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/PackedVectorTest.cpp?rev=244835&r1=244834&r2=244835&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/PackedVectorTest.cpp (original)
+++ llvm/trunk/unittests/ADT/PackedVectorTest.cpp Wed Aug 12 18:26:12 2015
@@ -52,18 +52,6 @@ TEST(PackedVectorTest, Operation) {
   EXPECT_FALSE(Vec == Vec2);
   EXPECT_TRUE(Vec != Vec2);
 
-  Vec2.swap(Vec);
-  EXPECT_EQ(3U, Vec.size());
-  EXPECT_FALSE(Vec.empty());
-  EXPECT_EQ(0U, Vec[0]);
-  EXPECT_EQ(0U, Vec[1]);
-  EXPECT_EQ(0U, Vec[2]);
-
-  EXPECT_EQ(2U, Vec2[0]);
-  EXPECT_EQ(0U, Vec2[1]);
-  EXPECT_EQ(1U, Vec2[2]);
-  EXPECT_EQ(3U, Vec2[3]);
-
   Vec = Vec2;
   EXPECT_TRUE(Vec == Vec2);
   EXPECT_FALSE(Vec != Vec2);




More information about the llvm-commits mailing list