mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 19:44:38 +08:00
Remove bad space after "default".
Before:
switch (x) {
default : {}
}
After:
switch (x) {
default: {}
}
llvm-svn: 176861
This commit is contained in:
@@ -1042,7 +1042,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
||||
if (Tok.Type == TT_OverloadedOperatorLParen)
|
||||
return false;
|
||||
if (Tok.is(tok::colon))
|
||||
return Line.First.isNot(tok::kw_case) && !Tok.Children.empty() &&
|
||||
return Line.First.isNot(tok::kw_case) &&
|
||||
Line.First.isNot(tok::kw_default) && !Tok.Children.empty() &&
|
||||
Tok.Type != TT_ObjCMethodExpr;
|
||||
if (Tok.is(tok::l_paren) && !Tok.Children.empty() &&
|
||||
Tok.Children[0].Type == TT_PointerOrReference &&
|
||||
|
||||
@@ -423,6 +423,10 @@ TEST_F(FormatTest, FormatsSwitchStatement) {
|
||||
"}");
|
||||
verifyFormat("switch (test)\n"
|
||||
" ;");
|
||||
verifyFormat("switch (x) {\n"
|
||||
"default: {\n"
|
||||
" // Do nothing.\n"
|
||||
"}");
|
||||
|
||||
verifyGoogleFormat("switch (x) {\n"
|
||||
" case 1:\n"
|
||||
|
||||
Reference in New Issue
Block a user