Formatter: * and & are binary operators before ( and [.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172303 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index e4dc291..aa534b9 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -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;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index e5dbd63..4b3297d 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -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;");