[PATCH] D116316: [clang-format] Add an experimental option to remove optional control statement braces in LLVM C++ code
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 28 14:09:47 PST 2021
owenpan added inline comments.
================
Comment at: clang/docs/ClangFormatStyleOptions.rst:3419
+ if (isa<VarDecl>(D)) { vs. if (isa<VarDecl>(D)) {
+ for (auto *A : D.attrs()) { for (auto *A : D.attrs())
+ if (shouldProcessAttr(A)) { if (shouldProcessAttr(A))
----------------
curdeius wrote:
> I'm not sure if the braces on the right should be removed in the for loop.
> There should probably be an option to set the minimum number of lines/statements inside a control statement to control adding/removing braces.
> I'm not sure if the braces on the right should be removed in the for loop.
This //is// the LLVM [[ https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements | style ]]. See also line 23086 in FormatTest.cpp below.
> There should probably be an option to set the minimum number of lines/statements inside a control statement to control adding/removing braces.
If you have more than one statement inside a control statement block, the braces must stay.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116316/new/
https://reviews.llvm.org/D116316
More information about the cfe-commits
mailing list