llvm.org GIT mirror llvm / 149fe5e
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244835 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 4 years ago
2 changed file(s) with 1 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
9595 }
9696 };
9797
98 PackedVector() { }
98 PackedVector() = default;
9999 explicit PackedVector(unsigned size) : Bits(size << (BitNum-1)) { }
100100
101101 bool empty() const { return Bits.empty(); }
134134 return Bits != RHS.Bits;
135135 }
136136
137 const PackedVector &operator=(const PackedVector &RHS) {
138 Bits = RHS.Bits;
139 return *this;
140 }
141
142137 PackedVector &operator|=(const PackedVector &RHS) {
143138 Bits |= RHS.Bits;
144139 return *this;
145 }
146
147 void swap(PackedVector &RHS) {
148 Bits.swap(RHS.Bits);
149140 }
150141 };
151142
5151 EXPECT_FALSE(Vec == Vec2);
5252 EXPECT_TRUE(Vec != Vec2);
5353
54 Vec2.swap(Vec);
55 EXPECT_EQ(3U, Vec.size());
56 EXPECT_FALSE(Vec.empty());
57 EXPECT_EQ(0U, Vec[0]);
58 EXPECT_EQ(0U, Vec[1]);
59 EXPECT_EQ(0U, Vec[2]);
60
61 EXPECT_EQ(2U, Vec2[0]);
62 EXPECT_EQ(0U, Vec2[1]);
63 EXPECT_EQ(1U, Vec2[2]);
64 EXPECT_EQ(3U, Vec2[3]);
65
6654 Vec = Vec2;
6755 EXPECT_TRUE(Vec == Vec2);
6856 EXPECT_FALSE(Vec != Vec2);