Index: cfe/trunk/lib/Format/TokenAnnotator.cpp =================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -2095,7 +2095,7 @@ return true; for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen; Tok = Tok->Next) { - if (Tok->is(tok::l_paren) && Tok->MatchingParen) { + if (Tok->isOneOf(tok::l_paren, TT_TemplateOpener) && Tok->MatchingParen) { Tok = Tok->MatchingParen; continue; } Index: cfe/trunk/unittests/Format/FormatTest.cpp =================================================================== --- cfe/trunk/unittests/Format/FormatTest.cpp +++ cfe/trunk/unittests/Format/FormatTest.cpp @@ -5709,6 +5709,42 @@ "}\n" "template T *f(T &c);\n", // No break here. Style); + verifyFormat("int\n" + "foo(A a)\n" + "{\n" + " return a;\n" + "}\n", + Style); + verifyFormat("int\n" + "foo(A<8> a)\n" + "{\n" + " return a;\n" + "}\n", + Style); + verifyFormat("int\n" + "foo(A, 8> a)\n" + "{\n" + " return a;\n" + "}\n", + Style); + verifyFormat("int\n" + "foo(A, bool> a)\n" + "{\n" + " return a;\n" + "}\n", + Style); + verifyFormat("int\n" + "foo(A, bool> a)\n" + "{\n" + " return a;\n" + "}\n", + Style); + verifyFormat("int\n" + "foo(A, 8> a)\n" + "{\n" + " return a;\n" + "}\n", + Style); } TEST_F(FormatTest, AlwaysBreakBeforeMultilineStrings) {