Fix formatting of ObjC method calls.

This fixes llvm.org/PR15165.

We now correctly align:
  [image_rep drawInRect:drawRect
               fromRect:NSZeroRect
              operation:NSCompositeCopy
               fraction:1.0
             ssssssssdd:NO
                  hints:nil];

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174513 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index eac822c..3660b4a 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -488,7 +488,7 @@
               State.Stack.back().Indent + Current.LongestObjCSelectorName;
         else
           State.Stack.back().ColonPos =
-              State.Column + Spaces + Current.LongestObjCSelectorName;
+              State.Column + Spaces + Current.FormatTok.TokenLength;
       }
 
       // FIXME: Do we need to do this for assignments nested in other
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index fc95acc..c2e845b 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -2381,6 +2381,12 @@
                "                  selector:@selector(willEnterFullscreen)\n"
                "                      name:kWillEnterFullscreenNotification\n"
                "                    object:nil];");
+  verifyFormat("[image_rep drawInRect:drawRect\n"
+               "             fromRect:NSZeroRect\n"
+               "            operation:NSCompositeCopy\n"
+               "             fraction:1.0\n"
+               "       respectFlipped:NO\n"
+               "                hints:nil];");
 }
 
 TEST_F(FormatTest, ObjCAt) {