r214720 - clang-format: Understand parameter pack initialization.
Daniel Jasper
djasper at google.com
Mon Aug 4 07:51:03 PDT 2014
Author: djasper
Date: Mon Aug 4 09:51:02 2014
New Revision: 214720
URL: http://llvm.org/viewvc/llvm-project?rev=214720&view=rev
Log:
clang-format: Understand parameter pack initialization.
Before:
Constructor(A... a) : a_(X<A> { std::forward<A>(a) }...) {}
After:
Constructor(A... a) : a_(X<A>{std::forward<A>(a)}...) {}
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=214720&r1=214719&r2=214720&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon Aug 4 09:51:02 2014
@@ -354,7 +354,7 @@ void UnwrappedLineParser::calculateBrace
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) {
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=214720&r1=214719&r2=214720&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Aug 4 09:51:02 2014
@@ -4580,6 +4580,7 @@ TEST_F(FormatTest, UnderstandsTemplatePa
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> aaaaa);",
getLLVMStyleWithColumns(60));
verifyFormat("static_assert(is_convertible<A &&, B>::value, \"AAA\");");
+ verifyFormat("Constructor(A... a) : a_(X<A>{std::forward<A>(a)}...) {}");
}
TEST_F(FormatTest, UnderstandsBinaryOperators) {
More information about the cfe-commits
mailing list