Fix invalid formatting with spaces before trailing comments.

In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format from
creating a line with 81 columns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index aecc24c..8f2e00e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -778,7 +778,7 @@
   else if (Line.First.Type == TT_ObjCProperty)
     Line.Type = LT_ObjCProperty;
 
-  Line.First.SpaceRequiredBefore = true;
+  Line.First.SpacesRequiredBefore = 1;
   Line.First.MustBreakBefore = Line.First.FormatTok.MustBreakBefore;
   Line.First.CanBreakBefore = Line.First.MustBreakBefore;
 
@@ -790,7 +790,11 @@
     return;
   AnnotatedToken *Current = &Line.First.Children[0];
   while (Current != NULL) {
-    Current->SpaceRequiredBefore = spaceRequiredBefore(Line, *Current);
+    if (Current->Type == TT_LineComment)
+      Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments;
+    else
+      Current->SpacesRequiredBefore =
+          spaceRequiredBefore(Line, *Current) ? 1 : 0;
 
     if (Current->FormatTok.MustBreakBefore) {
       Current->MustBreakBefore = true;
@@ -814,7 +818,7 @@
     else
       Current->TotalLength =
           Current->Parent->TotalLength + Current->FormatTok.TokenLength +
-          (Current->SpaceRequiredBefore ? 1 : 0);
+          Current->SpacesRequiredBefore;
     // FIXME: Only calculate this if CanBreakBefore is true once static
     // initializers etc. are sorted out.
     // FIXME: Move magic numbers to a better place.