[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Francois Ferrand via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 17 09:41:42 PDT 2017
Typz added inline comments.
================
Comment at: unittests/Format/FormatTest.cpp:2476
"bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
- " + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
- " && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
- " > ccccccccccccccccccccccccccccccccccccccccc;",
+ " + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ " + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
----------------
Typz wrote:
> djasper wrote:
> > This looks very inconsistent to me.
> not sure what you mean, I do not really understand how this expression was aligned before the patch...
> it is not so much better in this case with the patch, but the '&&' is actually right-aligned with the '=' sign.
Seeing the test just before, I see (when breaking after operators) that the operands are actually right-aligned, e.g. all operators are on the same column.
So should it not be the same when breaking before the operator as well (independently from my patch, actually)?
bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
== aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
* bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
&& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
> ccccccccccccccccccccccccccccccccccccccccc;
Not sure I like this right-alignment thing, but at least I start to understand how we get this output (and this may be another option to prefer left-alignment?)
https://reviews.llvm.org/D32478
More information about the cfe-commits
mailing list