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

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 06:13:27 PST 2018


djasper added a comment.

You might doubt it, but having written the code I can tell you that it's the case. Shame on me for not writing a test, though.

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:

  foo(a, bbbbbbbbbbbbbbbbbb +
             ccccccccccccccccc);

and

  foo(a,
      bbbbbbbbbbbbbbbbbb +
          ccccccccccccccccc);

This formatting can easily alter between these two when line length vary slightly and I think being able to pattern match that easily.
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.


Repository:
  rC Clang

https://reviews.llvm.org/D42787





More information about the cfe-commits mailing list