Go to file
Daniel Jasper 7ae41cdd22 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
2013-07-03 10:34:47 +00:00
clang Don't insert confusing line breaks in comparisons. 2013-07-03 10:34:47 +00:00
clang-tools-extra Ran clang-format on Modularize.cpp to get a baseline for future changes. 2013-06-27 18:52:23 +00:00
compiler-rt [sanitizer] Fix Android build. 2013-07-02 14:51:31 +00:00
debuginfo-tests Now that we get non-trivial value parameters locations correct, un-XFAIL these tests. 2013-06-19 22:07:11 +00:00
libclc libclc: Add assembly versions of vstore for global [u]int4/8/16 2013-06-26 18:22:20 +00:00
libcxx Adorn make_unique with visibility and inline attributes 2013-07-02 20:06:09 +00:00
libcxxabi Updated CREDITS.TXT 2013-07-02 19:01:59 +00:00
lld Guard a test that fails on a Release build. 2013-07-03 09:09:13 +00:00
lldb Remove lldb's custom copy of the C++ demangler, used only on Mac 2013-07-03 04:52:51 +00:00
llvm [SystemZ] Fold more spills 2013-07-03 10:10:02 +00:00
polly clang-format latest changes 2013-07-02 16:13:07 +00:00