================ @@ -796,6 +796,44 @@ TEST_F(FormatTestComments, ParsesCommentsAdjacentToPPDirectives) { format("namespace {}\n /* Test */ #define A")); } +TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) { + verifyFormat("void f() {\n" + " if (true)\n" + " int i;\n" + " /* comment */\n" + "#ifdef A\n" + " int j;\n" + "#endif\n" + "}", + "void f() {\n" + " if (true)\n" + " int i;\n" + " /* comment */\n" + "#ifdef A\n" + " int j;\n" + "#endif\n" + "}"); + + verifyFormat("void f() {\n" + " if (true)\n" + " int i;\n" + " /* comment */\n" ---------------- owenca wrote:
It doesn't look right as the comment is likely for the line above it. https://github.com/llvm/llvm-project/pull/94776 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits