[cfe-commits] r172303 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp
Nico Weber
nicolasweber at gmx.de
Fri Jan 11 21:50:48 PST 2013
Author: nico
Date: Fri Jan 11 23:50:48 2013
New Revision: 172303
URL: http://llvm.org/viewvc/llvm-project?rev=172303&view=rev
Log:
Formatter: * and & are binary operators before ( and [.
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=172303&r1=172302&r2=172303&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Jan 11 23:50:48 2013
@@ -974,6 +974,7 @@
NextToken.Tok.is(tok::plus) || NextToken.Tok.is(tok::minus) ||
NextToken.Tok.is(tok::plusplus) || NextToken.Tok.is(tok::minusminus) ||
NextToken.Tok.is(tok::tilde) || NextToken.Tok.is(tok::exclaim) ||
+ NextToken.Tok.is(tok::l_paren) || NextToken.Tok.is(tok::l_square) ||
NextToken.Tok.is(tok::kw_alignof) || NextToken.Tok.is(tok::kw_sizeof))
return TT_BinaryOperator;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=172303&r1=172302&r2=172303&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Jan 11 23:50:48 2013
@@ -1016,6 +1016,9 @@
verifyFormat("a * --b;");
verifyFormat("a[4] * b;");
verifyFormat("f() * b;");
+ verifyFormat("a * [self dostuff];");
+ verifyFormat("a * (a + b);");
+ verifyFormat("(a *)(a + b);");
verifyFormat("int *pa = (int *)&a;");
verifyFormat("InvalidRegions[*R] = 0;");
More information about the cfe-commits
mailing list