[cfe-dev] clang-format behavior for Obj-C methods with block parameters

Yavuz Nuzumlalı via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 11 07:08:06 PST 2015


Hi everyone,

I'm experiencing a problem with clang-format for my code.

I'm using *ColumnLimit* as *120*. When I write some code like this:

*[self testMethod:15 withBlock:^{*
* NSLog(@"asdfasdf");*
* NSLog(@"asdfasdf");*
* NSLog(@"asdfasdf");*
* NSLog(@"asdfasdf");*
*}]**;*

This code would be converted to this by clang-format:

*[self testMethod:15*
*       withBlock:^{*
*       NSLog(@"asdfasdf");*
*       NSLog(@"asdfasdf");*
*       NSLog(@"asdfasdf");*
*       NSLog(@"asdfasdf");*
*   }];*

That seems wrong to me because the method call before block variable
actually fits in width of 120. I guess this is because clang-format behaves
above code as a single method call and assumes it as one line. But I really
want to not split the method like this because it feels weird.

Is there a way to accomplish this with current system?

I put my configuration file as an attachment.

Best
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151211/b32e20a0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .clang-format
Type: application/octet-stream
Size: 2069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151211/b32e20a0/attachment.obj>


More information about the cfe-dev mailing list