[PATCH] D95168: [clang-format] Add InsertBraces option
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 13 01:49:08 PDT 2021
MyDeveloperDay added a comment.
In D95168#3060296 <https://reviews.llvm.org/D95168#3060296>, @tiagoma wrote:
> go for it
@tiagoma to be honest this actually works pretty well, I've been using it in a private build on the large project I work on and I've been ripping through some of the legacy code adding braces like its gone out of fashion, it works a treat, I see only a couple of issues
1. the macros
2. nested missing braces
if (x)
for(int i....)
foo()
In the later case it will only do the inner for() (I haven't actually tested if I apply it again will it find the outer case)
Its substantially quicker than trying to do the same with clang-tidy, and from my experience with clang-tidy its actually a little more accurate! (sorry just saying!), as often the fix-it get a bit confused.
The recent RFC on the use of clang-format to modify code (https://lists.llvm.org/pipermail/llvm-dev/2021-August/152070.html) means that I think we can move forward with "modifing changes" like this one, where previously I would have been hesitant.
>From what I can tell you see, to exclude this from C# and Javascript (but I see no real reason why not do you?)
I'm happy to take a look further if you don't have time (I'll of course keep any credit to you!, this is a great idea).
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