forked from OSchip/llvm-project
clang-format: Fix regression in formatting of braced initializers.
Before: Node n{1, Node{1000}, // 2}; After: Node n{1, Node{1000}, // 2}; llvm-svn: 216540
This commit is contained in:
parent
870d951bda
commit
168c8aa679
|
@ -313,7 +313,9 @@ private:
|
|||
updateParameterCount(Left, CurrentToken);
|
||||
if (CurrentToken->isOneOf(tok::colon, tok::l_brace)) {
|
||||
FormatToken *Previous = CurrentToken->getPreviousNonComment();
|
||||
if (Previous->is(tok::identifier))
|
||||
if ((CurrentToken->is(tok::colon) ||
|
||||
Style.Language == FormatStyle::LK_Proto) &&
|
||||
Previous->is(tok::identifier))
|
||||
Previous->Type = TT_SelectorName;
|
||||
if (CurrentToken->is(tok::colon))
|
||||
Left->Type = TT_DictLiteral;
|
||||
|
|
|
@ -5466,6 +5466,8 @@ TEST_F(FormatTest, LayoutCxx11BraceInitializers) {
|
|||
verifyFormat("int foo(int i) { return fo1{}(i); }");
|
||||
verifyFormat("auto i = decltype(x){};");
|
||||
verifyFormat("std::vector<int> v = {1, 0 /* comment */};");
|
||||
verifyFormat("Node n{1, Node{1000}, //\n"
|
||||
" 2};");
|
||||
|
||||
// In combination with BinPackParameters = false.
|
||||
FormatStyle NoBinPacking = getLLVMStyle();
|
||||
|
|
Loading…
Reference in New Issue