Unified token breaking logic for strings and block comments.

Summary:
Both strings and block comments are broken into lines in
breakProtrudingToken. Logic specific for strings or block comments is abstracted
in implementations of the BreakToken interface. Among other goodness, this
change fixes placement of backslashes after a block comment inside a
preprocessor directive (see removed FIXMEs in unit tests).

The code is far from being polished, and some parts of it will be changed for
line comments support.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D665

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179526 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 8dadd03..cbf5cf9 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -845,10 +845,7 @@
             "   Macro comment   \\\n"
             "   with a long     \\\n"
             "   line            \\\n"
-            // FIXME: We should look at the length of the last line of the token
-            // instead of the full token's length.
-            //"  */               \\\n"
-            "   */\\\n"
+            "   */              \\\n"
             "  A + B",
             format("#define X \\\n"
                    "  /*\n"
@@ -860,10 +857,7 @@
   EXPECT_EQ("#define X          \\\n"
             "  /* Macro comment \\\n"
             "     with a long   \\\n"
-            // FIXME: We should look at the length of the last line of the token
-            // instead of the full token's length.
-            //"   line */         \\\n"
-            "     line */\\\n"
+            "     line */       \\\n"
             "  A + B",
             format("#define X \\\n"
                    "  /* Macro comment with a long\n"
@@ -873,10 +867,7 @@
   EXPECT_EQ("#define X          \\\n"
             "  /* Macro comment \\\n"
             "   * with a long   \\\n"
-            // FIXME: We should look at the length of the last line of the token
-            // instead of the full token's length.
-            //"   * line */       \\\n"
-            "   * line */\\\n"
+            "   * line */       \\\n"
             "  A + B",
             format("#define X \\\n"
                    "  /* Macro comment with a long  line */ \\\n"
@@ -3697,7 +3688,8 @@
             "\"text\"",
             format("\"some text\"", getLLVMStyleWithColumns(7)));
   EXPECT_EQ("\"some\"\n"
-            "\" text\"",
+            "\" tex\"\n"
+            "\"t\"",
             format("\"some text\"", getLLVMStyleWithColumns(6)));
   EXPECT_EQ("\"some\"\n"
             "\" tex\"\n"
@@ -3790,7 +3782,8 @@
             "\"000001\"",
             format("\"test\\000000000001\"", getLLVMStyleWithColumns(9)));
   EXPECT_EQ("\"test\\000\"\n"
-            "\"000000001\"",
+            "\"00000000\"\n"
+            "\"1\"",
             format("\"test\\000000000001\"", getLLVMStyleWithColumns(10)));
   EXPECT_EQ("R\"(\\x\\x00)\"\n",
             format("R\"(\\x\\x00)\"\n", getLLVMStyleWithColumns(7)));