PR50809
Differential Revision: https://reviews.llvm.org/D104774
parseBlock(/*MustBeDeclaration=*/false);
addUnwrappedLine();
} else if (FormatTok->Tok.is(tok::kw_if)) {
+ FormatToken *Previous = AllTokens[Tokens->getPosition() - 1];
+ bool PrecededByComment = Previous->is(tok::comment);
+ if (PrecededByComment) {
+ addUnwrappedLine();
+ ++Line->Level;
+ }
parseIfThenElse();
+ if (PrecededByComment)
+ --Line->Level;
} else {
addUnwrappedLine();
++Line->Level;
" g();\n"
"else\n"
" h();");
+ verifyFormat("if (a)\n"
+ " f();\n"
+ "else // comment\n"
+ " if (b) {\n"
+ " g();\n"
+ " h();\n"
+ " }");
verifyFormat("if constexpr (a)\n"
" f();\n"
"else if constexpr (b)\n"