diff options
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d0743081018..016c4db07bf 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -322,7 +322,7 @@ void UnwrappedLineParser::calculateBraceTypes() { // (for example while parsing lambdas). // // We exclude + and - as they can be ObjC visibility modifiers. - if (NextTok->isOneOf(tok::comma, tok::semi, tok::r_paren, + if (NextTok->isOneOf(tok::comma, tok::semi, tok::r_paren, tok::period, tok::r_square, tok::l_brace, tok::colon) || (NextTok->isBinaryOperator() && !NextTok->isOneOf(tok::plus, tok::minus))) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index ab3303ea928..b0b1c0f5615 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4671,6 +4671,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) { verifyFormat("new int[3]{ 1, 2, 3 };"); verifyFormat("return { arg1, arg2 };"); verifyFormat("return { arg1, SomeType{ parameter } };"); + verifyFormat("int count = set<int>{ f(), g(), h() }.size();"); verifyFormat("new T{ arg1, arg2 };"); verifyFormat("f(MyMap[{ composite, key }]);"); verifyFormat("class Class {\n" @@ -4706,6 +4707,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) { verifyFormat("new int[3]{1, 2, 3};", NoSpaces); verifyFormat("return {arg1, arg2};", NoSpaces); verifyFormat("return {arg1, SomeType{parameter}};", NoSpaces); + verifyFormat("int count = set<int>{f(), g(), h()}.size();", NoSpaces); verifyFormat("new T{arg1, arg2};", NoSpaces); verifyFormat("f(MyMap[{composite, key}]);", NoSpaces); verifyFormat("class Class {\n" |