diff options
author | Daniel Jasper <djasper@google.com> | 2013-07-03 10:34:47 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-07-03 10:34:47 +0000 |
commit | 7ae41cdd2264a8785ea53a997cd0bbb5b881e570 (patch) | |
tree | e42ccaa71f023a1df16d24b6dce2d379964332e7 /llvm/lib/Target/PowerPC | |
parent | ed1fab6b5bfb54d63102319a761011e985081cb4 (diff) | |
download | bcm5719-llvm-7ae41cdd2264a8785ea53a997cd0bbb5b881e570.tar.gz bcm5719-llvm-7ae41cdd2264a8785ea53a997cd0bbb5b881e570.zip |
Don't insert confusing line breaks in comparisons.
In general, clang-format breaks after an operator if the LHS spans
multiple lines. Otherwise, this can lead to confusing effects and
effectively hide the operator precendence, e.g. in
if (aaaaaaaaaaaaaa ==
bbbbbbbbbbbbbb && c) { ...
This patch removes this rule for comparisons, if the LHS is not a binary
expression itself as many users were wondering why clang-format inserts
an unnecessary linebreak.
Before:
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >
5) { ...
After:
if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) > 5) { ...
In the long run, we might:
- Want to do this for other binary expressions as well.
- Do this only if the RHS is short or even only if it is a literal.
llvm-svn: 185530
Diffstat (limited to 'llvm/lib/Target/PowerPC')
0 files changed, 0 insertions, 0 deletions