r236851 - clang-format: Several improvements around formatting braced lists.

Tobias Grosser tobias at grosser.es
Fri May 8 08:23:30 PDT 2015


On 05/08/2015 05:18 PM, Daniel Jasper wrote:
>
>
> On Fri, May 8, 2015 at 5:16 PM, Tobias Grosser <tobias at grosser.es
> <mailto:tobias at grosser.es>> wrote:
>
>     On 05/08/2015 03:51 PM, Daniel Jasper wrote:
>
>         Author: djasper
>         Date: Fri May  8 08:51:14 2015
>         New Revision: 236851
>
>         URL: http://llvm.org/viewvc/llvm-project?rev=236851&view=rev
>         Log:
>         clang-format: Several improvements around formatting braced lists.
>
>         In particular:
>         * If the difference between the longest and shortest element, we
>         copped
>             out of column format completely. Now, we instead allow to
>         arrange
>             these in a single column, essentially enforcing a
>         one-per-line format.
>         * Allow column layout even if there are braced lists. Especially, if
>             there are many short lists, this can be beneficial. The bad
>         case,
>             where there is a long nested init list is usually caught as
>         we now
>             limit the length difference of the longest and shortest element.
>
>
>     Hi Daniel,
>
>     this change caused the following formatting change in Polly:
>
>     -  Value *Args[] = {SubFn, SubFnParam, NumberOfThreads, LB, UB, Stride};
>     +  Value *Args[] = {SubFn,
>     +                   SubFnParam,
>     +                   NumberOfThreads,
>     +                   LB,
>     +                   UB,
>     +                   Stride};
>
>     I will change this in Polly. It might be useful to add some test case
>     that shows that in certain cases we want to format a list in column
>     layout even though it fits a single line.
>
>
> Do we? Do you actually think the new format is better?

I personally would probably just have left the old formatting, but as 
this case does not happen that often and both are readable, I don't have 
any strong opinion on this.

Though, I would like us to choose one formatting to which we will stick 
to in the future. Regarding which one to choose, feel free to take the 
one you like best.

Best,
Tobias




More information about the cfe-commits mailing list