mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
clang-format: Fix merging short case labels with comments.
This fixes llvm.org/PR24877. Patch by Benjamin Daly, thank you! llvm-svn: 248145
This commit is contained in:
parent
f41a631b50
commit
368369b453
@ -305,7 +305,8 @@ private:
|
||||
if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace))
|
||||
break;
|
||||
if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch,
|
||||
tok::kw_while, tok::comment))
|
||||
tok::kw_while, tok::comment) ||
|
||||
Line->Last->is(tok::comment))
|
||||
return 0;
|
||||
Length += I[1 + NumStmts]->Last->TotalLength + 1; // 1 for the space.
|
||||
}
|
||||
|
@ -756,6 +756,9 @@ TEST_F(FormatTest, ShortCaseLabels) {
|
||||
"case 7:\n"
|
||||
" // comment\n"
|
||||
" return;\n"
|
||||
"case 8:\n"
|
||||
" x = 8; // comment\n"
|
||||
" break;\n"
|
||||
"default: y = 1; break;\n"
|
||||
"}",
|
||||
Style);
|
||||
|
Loading…
Reference in New Issue
Block a user