Before:
vector<int>(*foo_)[6];
After:
vector<int> (*foo_)[6];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230625
91177308-0d34-0410-b5e6-
96231b3b80d8
if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) ||
Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr))
return true;
- if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren))
+ if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) &&
+ Right.isNot(TT_FunctionTypeLParen))
return Style.SpaceBeforeParens == FormatStyle::SBPO_Always;
if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
Left.MatchingParen && Left.MatchingParen->is(TT_OverloadedOperatorLParen))
verifyFormat("void f() { function(*some_pointer_var)[0] = 10; }");
}
+TEST_F(FormatTest, FormatsPointersToArrayTypes) {
+ verifyFormat("A (*foo_)[6];");
+ verifyFormat("vector<int> (*foo_)[6];");
+}
+
TEST_F(FormatTest, BreaksLongVariableDeclarations) {
verifyFormat("LoooooooooooooooooooooooooooooooooooooooongType\n"
" LoooooooooooooooooooooooooooooooooooooooongVariable;");