r176861 - Remove bad space after "default".
Daniel Jasper
djasper at google.com
Tue Mar 12 05:26:55 PDT 2013
Author: djasper
Date: Tue Mar 12 07:26:55 2013
New Revision: 176861
URL: http://llvm.org/viewvc/llvm-project?rev=176861&view=rev
Log:
Remove bad space after "default".
Before:
switch (x) {
default : {}
}
After:
switch (x) {
default: {}
}
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=176861&r1=176860&r2=176861&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Mar 12 07:26:55 2013
@@ -1042,7 +1042,8 @@ bool TokenAnnotator::spaceRequiredBefore
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 &&
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=176861&r1=176860&r2=176861&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Mar 12 07:26:55 2013
@@ -423,6 +423,10 @@ TEST_F(FormatTest, FormatsSwitchStatemen
"}");
verifyFormat("switch (test)\n"
" ;");
+ verifyFormat("switch (x) {\n"
+ "default: {\n"
+ " // Do nothing.\n"
+ "}");
verifyGoogleFormat("switch (x) {\n"
" case 1:\n"
More information about the cfe-commits
mailing list