Handle overloaded operators in ?: precedence warning

This is a follow-up to r132565, and should address the rest of PR9969:

Warn about cases such as

int foo(A a, bool b) {
 return a + b ? 1 : 2; // user probably meant a + (b ? 1 : 2);
}

also when + is an overloaded operator call.

llvm-svn: 132784
diff --git a/clang/test/Sema/parentheses.cpp b/clang/test/Sema/parentheses.cpp
index ad1f399..a25f2a0 100644
--- a/clang/test/Sema/parentheses.cpp
+++ b/clang/test/Sema/parentheses.cpp
@@ -16,3 +16,16 @@
                                 // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
                                 // expected-note {{place parentheses around the * expression to silence this warning}}
 }
+
+class Stream {
+public:
+  operator int();
+  Stream &operator<<(int);
+  Stream &operator<<(const char*);
+};
+
+void f(Stream& s, bool b) {
+  (void)(s << b ? "foo" : "bar"); // expected-warning {{?: has lower precedence than <<}} \
+                                  // expected-note {{place parentheses around the ?: expression to evaluate it first}} \
+                                  // expected-note {{place parentheses around the << expression to silence this warning}}
+}