clang-format: Merge labels and subsequent semicolons.
E.g.:
default:;
This can be used to get around restrictions as to what can follow a
label. It fixes llvm.org/PR19648.
llvm-svn: 236604
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b4c8c26..000f87c 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -692,6 +692,11 @@
" case OP_name: \\\n"
" return operations::Operation##name\n",
getLLVMStyleWithColumns(40));
+ verifyFormat("switch (x) {\n"
+ "case 1:;\n"
+ "default:;\n"
+ " int i;\n"
+ "}");
verifyGoogleFormat("switch (x) {\n"
" case 1:\n"
@@ -827,6 +832,11 @@
"test_label:\n"
" some_other_code();\n"
"}");
+ verifyFormat("{\n"
+ " some_code();\n"
+ "test_label:;\n"
+ " int i = 0;\n"
+ "}");
}
//===----------------------------------------------------------------------===//