hanchenye-llvm-project/clang/unittests
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
..
AST Enhancements for the DynTypedNode 2013-06-19 18:45:24 +00:00
ASTMatchers clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp: Suppress unexpected failures on MS hosts. 2013-06-24 13:19:26 +00:00
Basic [Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about 2013-05-03 22:31:32 +00:00
Format Don't insert confusing line breaks in comparisons. 2013-07-03 10:34:47 +00:00
Frontend [Driver] Refactor clang driver to use LLVM's Option library 2013-06-14 17:17:23 +00:00
Lex Include Path.h instead of PathV2.h. 2013-06-11 22:15:02 +00:00
Tooling Bug fix: Make RecursiveASTVisitor<T>::TraverseLambdaExpr call 2013-06-30 03:13:35 +00:00
CMakeLists.txt Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so that 2013-05-29 21:09:18 +00:00
Makefile Dont use/link ARCMT, StaticAnalyzer and Rewriter to clang when the user 2012-12-13 16:09:42 +00:00