Extend the self move warning to record types.

Move the logic for checking self moves into SemaChecking and add that function
to Sema since it is now used in multiple places.

llvm-svn: 225756
diff --git a/clang/test/SemaCXX/warn-self-move.cpp b/clang/test/SemaCXX/warn-self-move.cpp
index ae2dab1..23778c1 100644
--- a/clang/test/SemaCXX/warn-self-move.cpp
+++ b/clang/test/SemaCXX/warn-self-move.cpp
@@ -38,3 +38,18 @@
     other.x = std::move(other.x);  // expected-warning{{explicitly moving}}
   }
 };
+
+struct A {};
+struct B { A a; };
+struct C { C() {}; ~C() {} };
+void struct_test() {
+  A a;
+  a = std::move(a);  // expected-warning{{explicitly moving}}
+
+  B b;
+  b = std::move(b);  // expected-warning{{explicitly moving}}
+  b.a = std::move(b.a);  // expected-warning{{explicitly moving}}
+
+  C c;
+  c = std::move(c);  // expected-warning{{explicitly moving}}
+}