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 | 6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc (patch) | |
| tree | a54540e3c529276afbd8366379ec1c60bd6ed311 /lib/CodeGen/CGExpr.cpp | |
| parent | 2a02f4d535ddae30898f013649d8c1902082921c (diff) | |
| download | clang-6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc.tar.gz clang-6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc.tar.bz2 clang-6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc.tar.xz | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
0 files changed, 0 insertions, 0 deletions
