[cfe-commits] r173160 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Tue Jan 22 07:36:22 PST 2013


On 22.01.2013, at 15:28, Daniel Jasper wrote:

> Author: djasper
> Date: Tue Jan 22 08:28:24 2013
> New Revision: 173160
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=173160&view=rev
> Log:
> Let the formatter be more restrictive for breaking around . and ->
> 
> Before:
> aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa)
>    .aaaaaaaaaaaaaaaaaa();
> 
> After:
> aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa,
>                aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();

Is that actually an improvement? I would prefer the former - the function call is one logical entity, so not breaking it up seems like a good idea. My company's in-house coding style rule about this is something like "break lines at the highest logical grouping possible". IOW, my logical understanding of the code here is

member_access(
.. call(aaaa, arguments(aaa, aaa, aaa)),
.. call(aaaa)
)

which I realize is not equivalent to the parse tree, but I basically split this into the function call that returns an object and the member function call on that object. It makes sense to me to break between those two calls rather than in the middle of one.

Sebastian



More information about the cfe-commits mailing list