clang-format: Fix corner cases for comments in if conditions.

Before:
  if ( // a
          x + 3) { ..

After:
  if ( // a
      x + 3) { ..

llvm-svn: 208175
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index bd7e23f..75f1854 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -390,6 +390,11 @@
                "else {\n"
                "  g()\n"
                "}");
+
+  verifyFormat("if (a) {\n"
+               "} else if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+               "               aaaaaaaaaaaaaaaaaaaaaaaaaaaa)) {\n"
+               "}");
 }
 
 TEST_F(FormatTest, FormatsForLoop) {
@@ -847,6 +852,18 @@
       "  int i;                        /* iiiiiiiiiiiiiiiiiiiii */ \\\n"
       "  int jjjjjjjjjjjjjjjjjjjjjjjj; /* */",
       getLLVMStyleWithColumns(61));
+
+  verifyFormat("if ( // This is some comment\n"
+               "    x + 3) {\n"
+               "}");
+  EXPECT_EQ("if ( // This is some comment\n"
+            "     // spanning two lines\n"
+            "    x + 3) {\n"
+            "}",
+            format("if( // This is some comment\n"
+                   "     // spanning two lines\n"
+                   " x + 3) {\n"
+                   "}"));
 }
 
 TEST_F(FormatTest, KeepsParameterWithTrailingCommentsOnTheirOwnLine) {