Improve operator kind detection in presence of comments.

We used to incorrectly identify some operators (*, &, +, -, etc.) if
there were comments around them.

Example:
Before: int a = /**/ - 1;
After:  int a = /**/ -1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172533 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index e9fa666..c6f1c8e 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1037,6 +1037,10 @@
 
   verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { -5, +3 };");
   verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { +5, -3 };");
+
+  verifyFormat("int a = /* confusing comment */ -1;");
+  // FIXME: The space after 'i' is wrong, but hopefully, this is a rare case.
+  verifyFormat("int a = i /* confusing comment */++;");
 }
 
 TEST_F(FormatTest, UndestandsOverloadedOperators) {
@@ -1123,6 +1127,13 @@
   verifyFormat("*(x + y).call();");
   verifyFormat("&(x + y)->call();");
   verifyFormat("&(*I).first");
+
+  verifyFormat("f(b * /* confusing comment */ ++c);");
+  verifyFormat(
+      "int *MyValues = {\n"
+      "  *A, // Operator detection might be confused by the '{'\n"
+      "  *BB // Operator detection might be confused by previous comment\n"
+      "};");
 }
 
 TEST_F(FormatTest, FormatsCasts) {