[cfe-commits] r172095 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp
Nico Weber
nicolasweber at gmx.de
Thu Jan 10 11:36:35 PST 2013
Author: nico
Date: Thu Jan 10 13:36:35 2013
New Revision: 172095
URL: http://llvm.org/viewvc/llvm-project?rev=172095&view=rev
Log:
Formatter: Don't put a space in ObjC number literals like @+50
Before:
@ -4.5
Now:
@-4.5
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=172095&r1=172094&r2=172095&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Jan 10 13:36:35 2013
@@ -946,7 +946,8 @@
if (Tok.Parent->is(tok::equal) || Tok.Parent->is(tok::l_paren) ||
Tok.Parent->is(tok::comma) || Tok.Parent->is(tok::l_square) ||
Tok.Parent->is(tok::question) || Tok.Parent->is(tok::colon) ||
- Tok.Parent->is(tok::kw_return) || Tok.Parent->is(tok::kw_case))
+ Tok.Parent->is(tok::kw_return) || Tok.Parent->is(tok::kw_case) ||
+ Tok.Parent->is(tok::at))
return TT_UnaryOperator;
// There can't be to consecutive binary operators.
@@ -1054,7 +1055,8 @@
return false;
if (Tok.Type == TT_UnaryOperator)
return Tok.Parent->isNot(tok::l_paren) &&
- Tok.Parent->isNot(tok::l_square);
+ Tok.Parent->isNot(tok::l_square) &&
+ Tok.Parent->isNot(tok::at);
if (Tok.Parent->is(tok::greater) && Tok.is(tok::greater)) {
return Tok.Type == TT_TemplateCloser && Tok.Parent->Type ==
TT_TemplateCloser && Style.SplitTemplateClosingGreater;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=172095&r1=172094&r2=172095&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Jan 10 13:36:35 2013
@@ -1402,11 +1402,10 @@
verifyFormat("@throw");
verifyFormat("@try");
- // FIXME: Make the uncommented lines below pass.
verifyFormat("@\"String\"");
verifyFormat("@1");
- //verifyFormat("@+4.8");
- //verifyFormat("@-4");
+ verifyFormat("@+4.8");
+ verifyFormat("@-4");
verifyFormat("@1LL");
verifyFormat("@.5");
verifyFormat("@'c'");
More information about the cfe-commits
mailing list