We will need a more principled solution, but we should not leave this
unfixed until we come up with one.
Before: void f() { int * a; }
After: void f() { int *a; }
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173252
91177308-0d34-0410-b5e6-
96231b3b80d8
if (getPrecedence(Current) == prec::Assignment ||
Current.is(tok::kw_return) || Current.is(tok::kw_throw))
IsRHS = true;
+ if (Current.is(tok::l_paren) && !Line.MustBeDeclaration)
+ IsRHS = true;
if (Current.Type == TT_Unknown) {
if (Current.is(tok::star) || Current.is(tok::amp)) {
// It is very unlikely that we are going to find a pointer or reference type
// definition on the RHS of an assignment.
- if (IsRHS || !Line.MustBeDeclaration)
+ if (IsRHS)
return TT_BinaryOperator;
return TT_PointerOrReference;
verifyFormat("int a = *b;");
verifyFormat("int a = *b * c;");
verifyFormat("int a = b * *c;");
+ verifyFormat("void f() { int *a = b * c; }");
verifyFormat("int main(int argc, char **argv) {}");
verifyFormat("return 10 * b;");
verifyFormat("return *b * *c;");