[PATCH] D42787: clang-format: do not add extra indent when wrapping last parameter

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 06:23:21 PST 2018


Typz added a comment.

> You might doubt it, but having written the code I can tell you that it's the case.

Ok, you win :-)

> I see the argument why this indentation is not necessary in exactly the case where the last parameter is multi-line and not wrapped to a new line itself: You always have some indentation anyway because of the preceding parameter on the same line.
>  However, for me the consistency is more important here, i.e. achieving that we don't have a relative indentation change between:
>  [...] 
>  This formatting can easily alter between these two when line length vary slightly and I think being able to pattern match that easily.

Not sure what you mean: a diff would not be trivial in either case...

> Yes, that means it is not consistent with:
> 
>   foo(bbbbbbbbbbbbbbbbbb +
>       ccccccccccccccccc);
>    
> 
> But there is actually a substantial difference in structure and so, I think it is reasonable to not be consistent there.

It's reasonable from the perspective of the tool [i.e. to make the code of clang-format consistent], but IMHO not so consistent from the perspective of a user:
I (and most people I believe) would not manually add this seemingly unnecessary indentation, so I would prefer the tool to do the same; and fortunately it seems pretty trivial to implement.

Is there a way this can go in anyway, for exemple with a setting?


Repository:
  rC Clang

https://reviews.llvm.org/D42787





More information about the cfe-commits mailing list