summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-07-03 10:34:47 +0000
committerDaniel Jasper <djasper@google.com>2013-07-03 10:34:47 +0000
commit6df7a2db6d74d41c4150b2c46b9a9e4e2db6c1dc (patch)
treea54540e3c529276afbd8366379ec1c60bd6ed311 /lib/CodeGen/CGExpr.cpp
parent2a02f4d535ddae30898f013649d8c1902082921c (diff)
downloadclang-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