forked from OSchip/llvm-project
clang-format: Don't indent relative to unary operators (some more).
Before: long aaaaaaaa = !aaaa( // break aaaaaa); long aaaaaaaa = !aa.aa( // break aaaaaa); After: long aaaaaaaa = !aaaa( // break aaaaaa); long aaaaaaaa = !aa.aa( // break aaaaaa); llvm-svn: 240934
This commit is contained in:
parent
17cace6475
commit
739b85f2e7
|
@ -815,7 +815,7 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
|
|||
// ParameterToInnerFunction));
|
||||
if (*I > prec::Unknown)
|
||||
NewParenState.LastSpace = std::max(NewParenState.LastSpace, State.Column);
|
||||
if (*I != prec::Conditional)
|
||||
if (*I != prec::Conditional && !Current.is(TT_UnaryOperator))
|
||||
NewParenState.StartOfFunctionCall = State.Column;
|
||||
|
||||
// Always indent conditional expressions. Never indent expression where
|
||||
|
|
|
@ -3921,10 +3921,12 @@ TEST_F(FormatTest, BreaksDesireably) {
|
|||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
|
||||
|
||||
// Indent consistently independent of call expression.
|
||||
// Indent consistently independent of call expression and unary operator.
|
||||
verifyFormat("aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(\n"
|
||||
" dddddddddddddddddddddddddddddd));");
|
||||
verifyFormat("aaaaaaaaaaa(!bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(\n"
|
||||
" dddddddddddddddddddddddddddddd));");
|
||||
verifyFormat("aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(\n"
|
||||
" dddddddddddddddddddddddddddddd));\n"
|
||||
"aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(\n"
|
||||
" dddddddddddddddddddddddddddddd));");
|
||||
|
||||
// This test case breaks on an incorrect memoization, i.e. an optimization not
|
||||
|
@ -5190,7 +5192,7 @@ TEST_F(FormatTest, DoesNotIndentRelativeToUnaryOperators) {
|
|||
" aaaaa)) {\n"
|
||||
"}");
|
||||
verifyFormat("aaaaaaaaaa(!aaaaaaaaaa( // break\n"
|
||||
" aaaaa));");
|
||||
" aaaaa));");
|
||||
verifyFormat("*aaa = aaaaaaa( // break\n"
|
||||
" bbbbbb);");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue