clang-format: Handle comments in short case labels.
With AllowShortCaseLabelsOnASingleLine set to true:
This gets now left unchanged:
case 1:
// comment
return;
Whereas before it was changed into:
case 1: // comment return;
This fixes llvm.org/PR21630.
llvm-svn: 222529
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index a6bbe16..c58ac0a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -745,6 +745,11 @@
"case 3:\n"
"case 4:\n"
"case 5: return;\n"
+ "case 6: // comment\n"
+ " return;\n"
+ "case 7:\n"
+ " // comment\n"
+ " return;\n"
"default: y = 1; break;\n"
"}",
Style);