[PATCH] D154550: [clang-format] Allow empty loops on a single line.
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 23 18:47:58 PDT 2023
owenpan added a comment.
Like `while (a);`, `while (a) {}` is also an empty loop, so `NonEmpty` is misleading if it excludes the former but not the latter. IMO we should just fix the bug without extending the option because any loop with a single-statement body is a short loop.
================
Comment at: clang/unittests/Format/FormatTest.cpp:1444-1467
+ verifyFormat("while (true) ;",
+ AllowsMergedLoops);
+ verifyFormat("for (;;) ;",
+ AllowsMergedLoops);
+ verifyFormat("for (;;)\n"
+ " for (;;) continue;",
+ AllowsMergedLoops);
----------------
There should be no spaces between `)` and `;`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154550/new/
https://reviews.llvm.org/D154550
More information about the cfe-commits
mailing list