HomePhabricator

[clang-format] Fix ObjC message arguments formatting.

Description

[clang-format] Fix ObjC message arguments formatting.

Summary:
Fixes formatting of ObjC message arguments when inline block is a first
argument.

Having inline block as a first argument when method has multiple parameters is
discouraged by Apple:
"It’s best practice to use only one block argument to a method. If the
method also needs other non-block arguments, the block should come last"
(https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW7),
it should be correctly formatted nevertheless.

Current formatting:

[object blockArgument:^{
  a = 42;
}
    anotherArg:42];

Fixed (colon alignment):

[object
  blockArgument:^{
    a = 42;
  }
     anotherArg:42];

Test Plan: make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, benhamilton

Reviewed By: krasimir, benhamilton

Subscribers: benhamilton, klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D42493

Details

Committed
jolesiakFeb 7 2018, 2:35 AM
Reviewer
krasimir
Differential Revision
D42493: [clang-format] Fix ObjC message arguments formatting.
Branches
Unknown
Tags
Unknown