From: Daniel Jasper Date: Mon, 4 Aug 2014 14:51:02 +0000 (+0000) Subject: clang-format: Understand parameter pack initialization. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54e272c2816ce05ddf8f62b867459c0374e68c9e;p=clang clang-format: Understand parameter pack initialization. Before: Constructor(A... a) : a_(X { std::forward(a) }...) {} After: Constructor(A... a) : a_(X{std::forward(a)}...) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214720 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 293fd3c8bd..ed28497ab9 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -354,7 +354,7 @@ void UnwrappedLineParser::calculateBraceTypes() { ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::semi, tok::period, tok::colon, tok::r_paren, tok::r_square, tok::l_brace, - tok::l_paren) || + tok::l_paren, tok::ellipsis) || (NextTok->isBinaryOperator() && !NextIsObjCMethod); } if (ProbablyBracedList) { diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index b175d2a2ec..8089b3e36e 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -4580,6 +4580,7 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) { " aaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> aaaaa);", getLLVMStyleWithColumns(60)); verifyFormat("static_assert(is_convertible::value, \"AAA\");"); + verifyFormat("Constructor(A... a) : a_(X{std::forward(a)}...) {}"); } TEST_F(FormatTest, UnderstandsBinaryOperators) {