[PATCH] D95168: [clang-format] Add InsertBraces option
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 3 01:44:44 PDT 2021
MyDeveloperDay added a comment.
> I'm in favor of a struct of enums:
>
> AutomaticBraces:
> AfterIf: OnlyIfElse
> AfterElse: Remove #this is obviously only to remove, if the else body is a single line
> AfterWhile: ...
>
> And we can gradually add new enumerators to handle the delicate nuances of adding or removing the braces.
> And we should add them one after another.
I like this approach, let me switch over to a struct (that might take me a bit, I'll reorder on the way), I do sort of feel this is for both Inserting/Removing of Braces at the same time should also be the reverse.
i.e. we may not always want to add braces (but allow similar rules to LLVM style)
So a clang-format could be a combination of adding and removing braces depending on the location and usecase, hence in my view why we might as well do this all in one review. I personally wouldn't want 1 implementation for inserting and 1 for removing hence they need to share that configuration.
@tiagoma, I'm going to change the name of the class and file too, just to make that its both Inserting and Removing.
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