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];

llvm-svn: 174513
This commit is contained in:
Daniel Jasper 2013-02-06 16:00:26 +00:00
parent d265090cd6
commit c485b4e5b8
2 changed files with 7 additions and 1 deletions

View File

@ -488,7 +488,7 @@ private:
State.Stack.back().Indent + Current.LongestObjCSelectorName; State.Stack.back().Indent + Current.LongestObjCSelectorName;
else else
State.Stack.back().ColonPos = 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 // FIXME: Do we need to do this for assignments nested in other

View File

@ -2381,6 +2381,12 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
" selector:@selector(willEnterFullscreen)\n" " selector:@selector(willEnterFullscreen)\n"
" name:kWillEnterFullscreenNotification\n" " name:kWillEnterFullscreenNotification\n"
" object:nil];"); " 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) { TEST_F(FormatTest, ObjCAt) {