[PATCH] D95168: [clang-format] Add InsertBraces option
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 3 01:44:40 PDT 2021
owenpan added a comment.
In D95168#3102550 <https://reviews.llvm.org/D95168#3102550>, @MyDeveloperDay wrote:
> This is a demo of what I mean {https://reviews.llvm.org/D113000} you can see its pretty aggressive, I could kind of imagine people wanting a little more control
>
> Sometimes this feels inconsistent
>
> F20029866: image.png <https://reviews.llvm.org/F20029866>
>
> and in this case the expression seem so separated from the if() that you might want to keep the {}
>
> F20029887: image.png <https://reviews.llvm.org/F20029887>
In my experience, the simplest thing to do is to remove all optional braces as allowed by the language syntax. When you want to add exceptions for matching if-else braces, avoiding dangling-else warnings, etc, things get much more complicated very quickly. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95168/new/
https://reviews.llvm.org/D95168
More information about the cfe-commits
mailing list