forked from OSchip/llvm-project
![]() 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 |
||
---|---|---|
.. | ||
BreakableToken.cpp | ||
BreakableToken.h | ||
CMakeLists.txt | ||
Encoding.h | ||
Format.cpp | ||
FormatToken.h | ||
Makefile | ||
TokenAnnotator.cpp | ||
TokenAnnotator.h | ||
UnwrappedLineParser.cpp | ||
UnwrappedLineParser.h | ||
WhitespaceManager.cpp | ||
WhitespaceManager.h |