Formatter: * and & are binary operators before ( and [.

llvm-svn: 172303
This commit is contained in:
Nico Weber 2013-01-12 05:50:48 +00:00
parent 5dafd4a7ae
commit eee7b81a16
2 changed files with 4 additions and 0 deletions

View File

@ -974,6 +974,7 @@ private:
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;

View File

@ -1016,6 +1016,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
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;");