Correctly format wrapped function call parameters in templated functions.

This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

llvm-svn: 171963
This commit is contained in:
Daniel Jasper 2013-01-09 09:50:48 +00:00
parent cdd5c2397a
commit 890589414b
2 changed files with 4 additions and 1 deletions

View File

@ -315,7 +315,7 @@ private:
WhitespaceStartColumn);
}
State.LastSpace[ParenLevel] = State.Indent[ParenLevel];
State.LastSpace[ParenLevel] = State.Column;
if (Current.is(tok::colon) && CurrentLineType != LT_ObjCMethodDecl &&
State.NextToken->Type != TT_ConditionalExpr)
State.Indent[ParenLevel] += 2;

View File

@ -869,6 +869,9 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) {
"aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
verifyFormat("template <typename T>\n"
"void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" int aaaaaaaaaaaaaaaaa);");
}