forked from OSchip/llvm-project
clang-format: Fix enumerator case ranges.
Before: case a... b: break; After: case a ... b: break; llvm-svn: 270027
This commit is contained in:
parent
19e04b6430
commit
e2fab13313
|
@ -1965,7 +1965,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
|||
if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
|
||||
return false;
|
||||
if (Right.is(tok::ellipsis))
|
||||
return Left.Tok.isLiteral();
|
||||
return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous &&
|
||||
Left.Previous->is(tok::kw_case));
|
||||
if (Left.is(tok::l_square) && Right.is(tok::amp))
|
||||
return false;
|
||||
if (Right.is(TT_PointerOrReference))
|
||||
|
|
|
@ -755,6 +755,7 @@ TEST_F(FormatTest, CaseRanges) {
|
|||
verifyFormat("switch (x) {\n"
|
||||
"case 'A' ... 'Z':\n"
|
||||
"case 1 ... 5:\n"
|
||||
"case a ... b:\n"
|
||||
" break;\n"
|
||||
"}");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue