forked from OSchip/llvm-project
Fix line-breaking problem caused by comment.
Before, clang-format would not find a solution for formatting: if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa cccccc) { } llvm-svn: 183096
This commit is contained in:
parent
2d18790b3a
commit
68d888cfed
|
@ -1040,6 +1040,7 @@ private:
|
|||
// should also break after the operator.
|
||||
if (Previous.Type == TT_BinaryOperator &&
|
||||
Current.Type != TT_BinaryOperator && // Special case for ">>".
|
||||
!Current.isTrailingComment() &&
|
||||
!Previous.isOneOf(tok::lessless, tok::question) &&
|
||||
Previous.getPrecedence() != prec::Assignment &&
|
||||
State.Stack.back().BreakBeforeParameter)
|
||||
|
|
|
@ -1991,6 +1991,10 @@ TEST_F(FormatTest, LineBreakingInBinaryExpressions) {
|
|||
" TheLine.Last->FormatTok.Tok.getLocation()) -\n"
|
||||
" 1);");
|
||||
|
||||
verifyFormat("if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||\n"
|
||||
" bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa\n"
|
||||
" cccccc) {\n}");
|
||||
|
||||
FormatStyle OnePerLine = getLLVMStyle();
|
||||
OnePerLine.BinPackParameters = false;
|
||||
verifyFormat(
|
||||
|
|
Loading…
Reference in New Issue