Implement the conditional-operator part of -Wsign-compare.  Turn
DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places.

Add some enumerator tests.  These seem to expose some oddities in the
types we're converting C++ enumerators to;  in particular, they're converting
to unsigned before int, which seems to contradict 4.5 [conv.prom] p2.

Note to self: stop baiting Doug in my commit messages.

llvm-svn: 86128
diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c
index 50b40e4..9cbbfba 100644
--- a/clang/test/Sema/compare.c
+++ b/clang/test/Sema/compare.c
@@ -13,6 +13,18 @@
          ((short)a == b) + // expected-warning {{comparison of integers of different signs}}
          (a == (unsigned int) b) +  // expected-warning {{comparison of integers of different signs}}
          (a == (unsigned short) b); // expected-warning {{comparison of integers of different signs}}
+
+  enum Enum {B};
+  return (a == B) +
+         ((int)a == B) +
+         ((short)a == B) +
+         (a == (unsigned int) B) +  // expected-warning {{comparison of integers of different signs}}
+         (a == (unsigned short) B); // expected-warning {{comparison of integers of different signs}}         
+
+  // Should be able to prove all of these are non-negative.
+  return (b == (long) B) +
+         (b == (int) B) +
+         (b == (short) B);
 }
 
 int equal(char *a, const char *b) {