Before: A<sizeof (*x)> a;
After: A<sizeof(*x)> a;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181764
91177308-0d34-0410-b5e6-
96231b3b80d8
}
if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
return false;
- if (CurrentToken->Parent->Type == TT_PointerOrReference &&
+ if (Left->Parent &&
+ !Left->Parent->isOneOf(tok::kw_sizeof, tok::kw_alignof) &&
+ CurrentToken->Parent->Type == TT_PointerOrReference &&
CurrentToken->Parent->Parent->isOneOf(tok::l_paren, tok::coloncolon))
Left->DefinesFunctionType = true;
updateParameterCount(Left, CurrentToken);
verifyGoogleFormat("A<void*(int*, SomeType*)>;");
verifyGoogleFormat("void* (*a)(int);");
+
+ // Other constructs can look like function types:
+ verifyFormat("A<sizeof(*x)> a;");
+ verifyFormat("A<alignof(*x)> a;");
}
TEST_F(FormatTest, BreaksLongDeclarations) {