[llvm-bugs] [Bug 50423] New: [Format/ObjC] Improve handling of block parameter arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 20 13:38:52 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50423

            Bug ID: 50423
           Summary: [Format/ObjC] Improve handling of block parameter
                    arguments
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bhamiltoncx at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Objective-C block parameters to method definitions currently break after the
opening paren:

```
% clang-format -style=Google test.m
@property(nonatomic, readonly, nullable) NSString *AAAAAAAAAAA;

- (instancetype)AAAAAAAAAAAAAAAAAAAAAAAAAAA:(id)AAAAAA
             
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA:(AAAAAAAAAAAAAAAA<AAAAAAAAAAAAAAAAAAAAAAAAA> *
(^)(
                                               
void))AAAAAAAAAAAAAAAAAAAAAAAAAAAAA {
}
```

I think it's OK to split the return type from the rest, but it looks odd to
split between the
`(^)(` and the parameter type `void)`. Ideally putting everyone on one line
would work:

```
@property(nonatomic, readonly, nullable) NSString *AAAAAAAAAAA;

- (instancetype)AAAAAAAAAAAAAAAAAAAAAAAAAAA:(id)AAAAAA
              AAAAAAAAAAAAAAAAAAAAAAAAAAAAA:
    (AAAAAAAAAAAAAAAA<AAAAAAAAAAAAAAAAAAAAAAAAA>
*(^)(void))AAAAAAAAAAAAAAAAAAAAAAAAAAAAA {
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210520/5bfee3db/attachment.html>


More information about the llvm-bugs mailing list