[PATCH] D35557: clang-format: merge short case labels with trailing comments

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 14:31:31 PDT 2017


Typz added inline comments.


================
Comment at: unittests/Format/FormatTest.cpp:912
+               "  break;\n"
+               "}",
+               Style);
----------------
krasimir wrote:
> I'd suggest adding more cases here, like:
> ```
>                "case 6: /* comment */ x = 1; break;\n"
>                "case 7: x = /* comment */ 1; break;\n"
>                "case 8:\n"
>                "  x = 1; /* comment */\n"
>                "  break;\n"
>                "case 9:\n"
>                "  break; // comment line 1\n"
>                "         // comment line 2\n"
>                "case 10:\n"
>                "  return; /* comment line 1\n"
>                "           * comment line 2 */\n"
>                "}",
> ```
> I'm interested also why `case 10` here fails.
`case 10` fails because of test::messUp(), which removes the line break inside the comment.


https://reviews.llvm.org/D35557





More information about the cfe-commits mailing list