For non-floating point types, added check for expressions of the form
"x == x" and "x != x".  We emit a warning for these since they always evaluate
to a constant value and often indicate a logical error.

Added test case for this check.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43450 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/self-comparison.c b/test/Sema/self-comparison.c
new file mode 100644
index 0000000..450673c
--- /dev/null
+++ b/test/Sema/self-comparison.c
@@ -0,0 +1,17 @@
+// RUN: clang -fsyntax-only -verify %s
+
+int foo(int x) {
+  return x == x; // expected-warning {{self-comparison always results}}
+}
+
+int foo2(int x) {
+  return (x) != (((x))); // expected-warning {{self-comparison always results}}
+}
+
+int bar(float x) {
+  return x == x; // no-warning
+}
+
+int bar2(float x) {
+  return x != x; // no-warning
+}
\ No newline at end of file