This revision was automatically updated to reflect the committed changes. Closed by commit rG400da115c58a: [clang-format] Fix braced initializer with templated base class (authored by galenelias, committed by owenpan).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156705/new/ https://reviews.llvm.org/D156705 Files: clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -13458,6 +13458,8 @@ verifyFormat( "class A {\n" " A() : a{} {}\n" + " A() : Base<int>{} {}\n" + " A() : Base<Foo<int>>{} {}\n" " A(int b) : b(b) {}\n" " A(int a, int b) : a(a), bs{{bs...}} { f(); }\n" " int a, b;\n" Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -581,7 +581,8 @@ ProbablyBracedList = ProbablyBracedList || (NextTok->is(tok::l_brace) && LBraceStack.back().PrevTok && - LBraceStack.back().PrevTok->is(tok::identifier)); + LBraceStack.back().PrevTok->isOneOf(tok::identifier, + tok::greater)); ProbablyBracedList = ProbablyBracedList ||
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -13458,6 +13458,8 @@ verifyFormat( "class A {\n" " A() : a{} {}\n" + " A() : Base<int>{} {}\n" + " A() : Base<Foo<int>>{} {}\n" " A(int b) : b(b) {}\n" " A(int a, int b) : a(a), bs{{bs...}} { f(); }\n" " int a, b;\n" Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -581,7 +581,8 @@ ProbablyBracedList = ProbablyBracedList || (NextTok->is(tok::l_brace) && LBraceStack.back().PrevTok && - LBraceStack.back().PrevTok->is(tok::identifier)); + LBraceStack.back().PrevTok->isOneOf(tok::identifier, + tok::greater)); ProbablyBracedList = ProbablyBracedList ||
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits