Before (note the missing space before "..." which can lead to compile
errors):
switch (x) {
case 'A'... 'Z':
case 1... 5:
break;
}
After:
switch (x) {
case 'A' ... 'Z':
case 1 ... 5:
break;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193050
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
return false;
if (Right.is(tok::ellipsis))
- return false;
+ return Left.Tok.isLiteral();
if (Left.is(tok::l_square) && Right.is(tok::amp))
return false;
if (Right.Type == TT_PointerOrReference)
"});");
}
+TEST_F(FormatTest, CaseRanges) {
+ verifyFormat("switch (x) {\n"
+ "case 'A' ... 'Z':\n"
+ "case 1 ... 5:\n"
+ " break;\n"
+ "}");
+}
+
TEST_F(FormatTest, FormatsLabels) {
verifyFormat("void f() {\n"
" some_code();\n"