forked from OSchip/llvm-project
Fix handling of fake parenthesis during formatting.
They are much easier to handle when attached to the previous token. Before: unsigned Indent = formatFirstToken(TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); After: unsigned Indent = formatFirstToken( TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); llvm-svn: 174718
This commit is contained in:
parent
a6016e4351
commit
8360a86c8c
|
@ -722,7 +722,7 @@ public:
|
|||
if (OperatorFound) {
|
||||
++Start->FakeLParens;
|
||||
if (Current != NULL)
|
||||
++Current->FakeRParens;
|
||||
++Current->Parent->FakeRParens;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
|
||||
/// \brief Insert this many fake ( before this token for correct indentation.
|
||||
unsigned FakeLParens;
|
||||
/// \brief Insert this many fake ) before this token for correct indentation.
|
||||
/// \brief Insert this many fake ) after this token for correct indentation.
|
||||
unsigned FakeRParens;
|
||||
|
||||
const AnnotatedToken *getPreviousNoneComment() const {
|
||||
|
|
|
@ -1271,6 +1271,11 @@ TEST_F(FormatTest, BreaksConditionalExpressions) {
|
|||
" : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa),\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaa);");
|
||||
verifyFormat(
|
||||
"unsigned Indent = formatFirstToken(\n"
|
||||
" TheLine.First, IndentForLevel[TheLine.Level] >= 0\n"
|
||||
" ? IndentForLevel[TheLine.Level] : TheLine * 2,\n"
|
||||
" TheLine.InPPDirective, PreviousEndOfLineColumn);");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, DeclarationsOfMultipleVariables) {
|
||||
|
|
Loading…
Reference in New Issue