Delint for "use after move"
Some unittests break the clang-tidy rule "bugprone-use-after-move". Moved-from variables after move shouldn't be accessed even in the tests. No one should care the behavior of moved-from objects. There is no pointing testing something that shouldn't be observable with good code practice ensured by clang-tidy. This commit fixes the problem by removing the lines accessing moved-from variables after move. Bug: dawn:1436, dawn:1437, dawn:1438, dawn:1440 Change-Id: I5a6ccaa6fa74e607f818b5296a1715196bfd0f25 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92204 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Takahiro <hogehoge@gachapin.jp> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
2d74e1cf71
commit
232abaefc3
|
@ -110,8 +110,6 @@ TEST_F(ITypVectorTest, MoveConstructAssign) {
|
|||
ASSERT_EQ(vec[Key(0)], Val(2));
|
||||
ASSERT_EQ(vec[Key(1)], Val(8));
|
||||
ASSERT_EQ(vec[Key(2)], Val(1));
|
||||
|
||||
ASSERT_EQ(rhs.size(), Key(0));
|
||||
}
|
||||
|
||||
// Test the move assignment
|
||||
|
@ -123,8 +121,6 @@ TEST_F(ITypVectorTest, MoveConstructAssign) {
|
|||
ASSERT_EQ(vec[Key(0)], Val(2));
|
||||
ASSERT_EQ(vec[Key(1)], Val(8));
|
||||
ASSERT_EQ(vec[Key(2)], Val(1));
|
||||
|
||||
ASSERT_EQ(rhs.size(), Key(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -337,9 +337,6 @@ TEST(LinkedList, NodeMoveConstructor) {
|
|||
|
||||
MovableNode n2_new(std::move(n2));
|
||||
|
||||
EXPECT_EQ(nullptr, n2.next());
|
||||
EXPECT_EQ(nullptr, n2.previous());
|
||||
|
||||
EXPECT_EQ(&n1, n2_new.previous());
|
||||
EXPECT_EQ(&n2_new, n1.next());
|
||||
EXPECT_EQ(&n3, n2_new.next());
|
||||
|
|
|
@ -159,7 +159,6 @@ TEST(ObjectBase, MoveConstructor) {
|
|||
Object source(&refcount);
|
||||
Object destination(std::move(source));
|
||||
|
||||
ASSERT_EQ(source.Get(), nullptr);
|
||||
ASSERT_EQ(destination.Get(), &refcount);
|
||||
ASSERT_EQ(2, refcount);
|
||||
|
||||
|
@ -175,7 +174,6 @@ TEST(ObjectBase, MoveAssignment) {
|
|||
Object destination;
|
||||
destination = std::move(source);
|
||||
|
||||
ASSERT_EQ(source.Get(), nullptr);
|
||||
ASSERT_EQ(destination.Get(), &refcount);
|
||||
ASSERT_EQ(2, refcount);
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ TEST(Ref, MoveConstructor) {
|
|||
original->Release();
|
||||
EXPECT_EQ(original->GetRefCountForTesting(), 1u);
|
||||
|
||||
EXPECT_EQ(source.Get(), nullptr);
|
||||
EXPECT_EQ(destination.Get(), original);
|
||||
EXPECT_FALSE(deleted);
|
||||
|
||||
|
@ -209,7 +208,6 @@ TEST(Ref, MoveAssignment) {
|
|||
destination = std::move(source);
|
||||
EXPECT_EQ(original->GetRefCountForTesting(), 1u);
|
||||
|
||||
EXPECT_EQ(source.Get(), nullptr);
|
||||
EXPECT_EQ(destination.Get(), original);
|
||||
EXPECT_FALSE(deleted);
|
||||
|
||||
|
@ -234,7 +232,6 @@ TEST(Ref, MoveAssignmentSameObject) {
|
|||
|
||||
referenceToSource = std::move(source);
|
||||
|
||||
EXPECT_EQ(source.Get(), original);
|
||||
EXPECT_EQ(original->GetRefCountForTesting(), 1u);
|
||||
EXPECT_FALSE(deleted);
|
||||
|
||||
|
@ -356,7 +353,6 @@ TEST(Ref, MoveConstructorDerived) {
|
|||
original->Release();
|
||||
EXPECT_EQ(original->GetRefCountForTesting(), 1u);
|
||||
|
||||
EXPECT_EQ(source.Get(), nullptr);
|
||||
EXPECT_EQ(destination.Get(), original);
|
||||
EXPECT_FALSE(deleted);
|
||||
|
||||
|
@ -380,7 +376,6 @@ TEST(Ref, MoveAssignmentDerived) {
|
|||
|
||||
EXPECT_EQ(original->GetRefCountForTesting(), 1u);
|
||||
|
||||
EXPECT_EQ(source.Get(), nullptr);
|
||||
EXPECT_EQ(destination.Get(), original);
|
||||
EXPECT_FALSE(deleted);
|
||||
|
||||
|
|
Loading…
Reference in New Issue