forked from OSchip/llvm-project
clang-format: Fix behavior with comments before conditional expressions
Before: SomeFunction(aaaaaaaaaaaaaaaaa, // comment. ccccccccccccccccc ? aaaaaaaaaaaaaaaaaaaa : bbbbbbbbbbbbbbbbbbbb); After: SomeFunction(aaaaaaaaaaaaaaaaa, // comment. ccccccccccccccccc ? aaaaaaaaaaaaaaaaaaaa : bbbbbbbbbbbbbbbbbbbb); llvm-svn: 219921
This commit is contained in:
parent
823d8f6246
commit
1a31bab301
|
@ -1174,6 +1174,9 @@ private:
|
|||
}
|
||||
|
||||
void parseConditionalExpr() {
|
||||
while (Current && Current->isTrailingComment()) {
|
||||
next();
|
||||
}
|
||||
FormatToken *Start = Current;
|
||||
parse(prec::LogicalOr);
|
||||
if (!Current || !Current->is(tok::question))
|
||||
|
|
|
@ -4060,6 +4060,12 @@ TEST_F(FormatTest, BreaksConditionalExpressions) {
|
|||
" ?: aaaaaaaaaaaaaaa);\n"
|
||||
"}",
|
||||
NoBinPacking);
|
||||
|
||||
verifyFormat("SomeFunction(aaaaaaaaaaaaaaaaa,\n"
|
||||
" // comment.\n"
|
||||
" ccccccccccccccccccccccccccccccccccccccc\n"
|
||||
" ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
" : bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, BreaksConditionalExpressionsAfterOperator) {
|
||||
|
|
Loading…
Reference in New Issue