From: Daniel Jasper Date: Wed, 9 Jan 2013 09:50:48 +0000 (+0000) Subject: Correctly format wrapped function call parameters in templated functions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d64f73812f3e6473ef8b6b6ec909bb9d8a510843;p=clang Correctly format wrapped function call parameters in templated functions. This fixes llvm.org/PR14846. Before: template void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa); After: template void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( int aaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171963 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index e5e59f4550..fbcb228fbe 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -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; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index fb21ea7c6f..56d4e17468 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -869,6 +869,9 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { "aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,\n" " aaaaaaaaaaaaaaaaaaaaaaaaaa::aaaaaaaaaa,\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); + verifyFormat("template \n" + "void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" + " int aaaaaaaaaaaaaaaaa);"); }