Insert a space at the start of a line comment in case it starts with an alphanumeric character.

Summary:
"//Test" becomes "// Test". This change is aimed to improve code
readability and conformance to certain coding styles. If a comment starts with a
non-alphanumeric character, the space isn't added, e.g. "//-*-c++-*-" stays
unchanged.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183750 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp
index e6e4e01..e3ca32c 100644
--- a/lib/Format/WhitespaceManager.cpp
+++ b/lib/Format/WhitespaceManager.cpp
@@ -56,16 +56,15 @@
              InPPDirective && !Tok.IsFirst));
 }
 
-void WhitespaceManager::breakToken(const FormatToken &Tok, unsigned Offset,
-                                   unsigned ReplaceChars,
-                                   StringRef PreviousPostfix,
-                                   StringRef CurrentPrefix, bool InPPDirective,
-                                   unsigned Spaces) {
+void WhitespaceManager::replaceWhitespaceInToken(
+    const FormatToken &Tok, unsigned Offset, unsigned ReplaceChars,
+    StringRef PreviousPostfix, StringRef CurrentPrefix, bool InPPDirective,
+    unsigned Newlines, unsigned Spaces) {
   Changes.push_back(Change(
       true, SourceRange(Tok.getStartOfNonWhitespace().getLocWithOffset(Offset),
                         Tok.getStartOfNonWhitespace().getLocWithOffset(
                             Offset + ReplaceChars)),
-      Spaces, Spaces, 1, PreviousPostfix, CurrentPrefix,
+      Spaces, Spaces, Newlines, PreviousPostfix, CurrentPrefix,
       // FIXME: Unify token adjustment, so we don't split it between
       // BreakableToken and the WhitespaceManager. That would also allow us to
       // correctly store a tok::TokenKind instead of rolling our own enum.
@@ -214,10 +213,10 @@
       std::string ReplacementText =
           C.PreviousLinePostfix +
           (C.ContinuesPPDirective
-               ? getNewLineText(C.NewlinesBefore, C.Spaces,
+               ? getNewlineText(C.NewlinesBefore, C.Spaces,
                                 C.PreviousEndOfTokenColumn,
                                 C.EscapedNewlineColumn)
-               : getNewLineText(C.NewlinesBefore, C.Spaces)) +
+               : getNewlineText(C.NewlinesBefore, C.Spaces)) +
           C.CurrentLinePrefix;
       storeReplacement(C.OriginalWhitespaceRange, ReplacementText);
     }
@@ -237,26 +236,26 @@
       SourceMgr, CharSourceRange::getCharRange(Range), Text));
 }
 
-std::string WhitespaceManager::getNewLineText(unsigned NewLines,
+std::string WhitespaceManager::getNewlineText(unsigned Newlines,
                                               unsigned Spaces) {
-  return std::string(NewLines, '\n') + getIndentText(Spaces);
+  return std::string(Newlines, '\n') + getIndentText(Spaces);
 }
 
-std::string WhitespaceManager::getNewLineText(unsigned NewLines,
+std::string WhitespaceManager::getNewlineText(unsigned Newlines,
                                               unsigned Spaces,
                                               unsigned PreviousEndOfTokenColumn,
                                               unsigned EscapedNewlineColumn) {
-  std::string NewLineText;
-  if (NewLines > 0) {
+  std::string NewlineText;
+  if (Newlines > 0) {
     unsigned Offset =
         std::min<int>(EscapedNewlineColumn - 1, PreviousEndOfTokenColumn);
-    for (unsigned i = 0; i < NewLines; ++i) {
-      NewLineText += std::string(EscapedNewlineColumn - Offset - 1, ' ');
-      NewLineText += "\\\n";
+    for (unsigned i = 0; i < Newlines; ++i) {
+      NewlineText += std::string(EscapedNewlineColumn - Offset - 1, ' ');
+      NewlineText += "\\\n";
       Offset = 0;
     }
   }
-  return NewLineText + getIndentText(Spaces);
+  return NewlineText + getIndentText(Spaces);
 }
 
 std::string WhitespaceManager::getIndentText(unsigned Spaces) {