forked from OSchip/llvm-project
Improve indentation of assignments.
Before: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; After: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; llvm-svn: 182733
This commit is contained in:
parent
75081b5cf8
commit
7b27a10b1e
|
@ -640,7 +640,10 @@ private:
|
|||
else if ((Previous.Type == TT_BinaryOperator ||
|
||||
Previous.Type == TT_ConditionalExpr ||
|
||||
Previous.Type == TT_CtorInitializerColon) &&
|
||||
getPrecedence(Previous) != prec::Assignment)
|
||||
!(getPrecedence(Previous) == prec::Assignment &&
|
||||
Current.FakeLParens.empty()))
|
||||
// Always indent relative to the RHS of the expression unless this is a
|
||||
// simple assignment without binary expression on the RHS.
|
||||
State.Stack.back().LastSpace = State.Column;
|
||||
else if (Previous.Type == TT_InheritanceColon)
|
||||
State.Stack.back().Indent = State.Column;
|
||||
|
|
|
@ -2336,6 +2336,10 @@ TEST_F(FormatTest, BreaksAfterAssignments) {
|
|||
verifyFormat(
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaa aaaa = aaaaaaaaaaaaaa(0).aaaa()\n"
|
||||
" .aaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa::aaaaaaaaaaaaaaaaaaaaa);");
|
||||
verifyFormat("unsigned OriginalStartColumn =\n"
|
||||
" SourceMgr.getSpellingColumnNumber(\n"
|
||||
" Current.FormatTok.getStartOfNonWhitespace()) -\n"
|
||||
" 1;");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, AlignsAfterAssignments) {
|
||||
|
|
Loading…
Reference in New Issue