[analyzer] MisusedMovedObject: Fix state-resetting a base-class sub-object.
If a method is resetting the state of an object that was moved from, it should
be safe to use this object again. However if the method was defined in a parent
class, but used in a child class, the reset didn't happen from the checker's
perspective.
Differential Revision: https://reviews.llvm.org/D31538
llvm-svn: 315301
diff --git a/clang/test/Analysis/MisusedMovedObject.cpp b/clang/test/Analysis/MisusedMovedObject.cpp
index 44e055f..57c1ecc 100644
--- a/clang/test/Analysis/MisusedMovedObject.cpp
+++ b/clang/test/Analysis/MisusedMovedObject.cpp
@@ -617,3 +617,11 @@
a.b.foo(); // no-warning
}
}
+
+class C: public A {};
+void resetSuperClass() {
+ C c;
+ C c1 = std::move(c);
+ c.clear();
+ C c2 = c; // no-warning
+}