Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable.  Fixes <rdar://problem/9259237>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141881 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index f716124..49af4f32 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -94,10 +94,15 @@
   for (;;) {}
 }
 
-int test15() {
-  int x = x; // no-warning: signals intended lack of initialization. \
-             // expected-note{{variable 'x' is declared here}}
-  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
+void test15() {
+  int x = x; // no-warning: signals intended lack of initialization.
+}
+
+int test15b() {
+  // Warn here with the self-init, since it does result in a use of
+  // an unintialized variable and this is the root cause.
+  int x = x; // expected-warning {{variable 'x' is uninitialized when used within its own initialization}}
+  return x;
 }
 
 // Don't warn in the following example; shows dataflow confluence.