[PATCH] D116001: [clang-format] add regression tests for braced lists
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 19 06:11:37 PST 2021
krasimir created this revision.
krasimir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Depends on https://reviews.llvm.org/D116000.
Added test cases from the comments on https://reviews.llvm.org/D114583.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116001
Files:
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -11515,6 +11515,17 @@
" };\n"
"};");
verifyFormat("#define A {a, a},");
+ // Don't confuse braced list initializers with compound statements.
+ verifyFormat(
+ "class A {\n"
+ " A() : a{} {}\n"
+ " A(int b) : b(b) {}\n"
+ " A(int a, int b) : a(a), bs{{bs...}} { f(); }\n"
+ " int a, b;\n"
+ " explicit Expr(const Scalar<Result> &x) : u{Constant<Result>{x}} {}\n"
+ " explicit Expr(Scalar<Result> &&x) : u{Constant<Result>{std::move(x)}} "
+ "{}\n"
+ "};");
// Avoid breaking between equal sign and opening brace
FormatStyle AvoidBreakingFirstArgument = getLLVMStyle();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116001.395325.patch
Type: text/x-patch
Size: 866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211219/0439d2c3/attachment.bin>
More information about the cfe-commits
mailing list