Fix handling of fake parenthesis during formatting.

They are much easier to handle when attached to the previous token.

Before:
unsigned Indent =
    formatFirstToken(TheLine.First, IndentForLevel[TheLine.Level] >=
                                    0 ? IndentForLevel[TheLine.Level]
: TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn);

After:
unsigned Indent = formatFirstToken(
    TheLine.First, IndentForLevel[TheLine.Level] >= 0
                       ? IndentForLevel[TheLine.Level] : TheLine.Level * 2,
    TheLine.InPPDirective, PreviousEndOfLineColumn);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174718 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 485624b..db05901 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -722,7 +722,7 @@
         if (OperatorFound) {
           ++Start->FakeLParens;
           if (Current != NULL)
-            ++Current->FakeRParens;
+            ++Current->Parent->FakeRParens;
         }
         return;
       }
diff --git a/lib/Format/TokenAnnotator.h b/lib/Format/TokenAnnotator.h
index dc936e4..85e4102 100644
--- a/lib/Format/TokenAnnotator.h
+++ b/lib/Format/TokenAnnotator.h
@@ -121,7 +121,7 @@
 
   /// \brief Insert this many fake ( before this token for correct indentation.
   unsigned FakeLParens;
-  /// \brief Insert this many fake ) before this token for correct indentation.
+  /// \brief Insert this many fake ) after this token for correct indentation.
   unsigned FakeRParens;
 
   const AnnotatedToken *getPreviousNoneComment() const {
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 7176fa5..997a553 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1271,6 +1271,11 @@
                "           : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
                "                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa),\n"
                "       aaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+  verifyFormat(
+      "unsigned Indent = formatFirstToken(\n"
+      "    TheLine.First, IndentForLevel[TheLine.Level] >= 0\n"
+      "                       ? IndentForLevel[TheLine.Level] : TheLine * 2,\n"
+      "    TheLine.InPPDirective, PreviousEndOfLineColumn);");
 }
 
 TEST_F(FormatTest, DeclarationsOfMultipleVariables) {