[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
Wed Dec 29 00:48:15 PST 2021


owenpan marked 2 inline comments as done.
owenpan added a comment.

In D116316#3211269 <https://reviews.llvm.org/D116316#3211269>, @curdeius wrote:

> Could you have a look at preceding reviews and see if there wasn't a similar patch before?

I conversed <https://reviews.llvm.org/D95168#3105413> with @MyDeveloperDay in D95168 <https://reviews.llvm.org/D95168>. In fact, that was one of the main reasons that I put in extra effort to get this patch done.

> I think that this option is a bit too limited.
> Only removing braces doesn't seem enough.

I wanted to implement as many features as possible using the limited parser of clang-format, and the LLVM style would be a very high bar to clear. Only focusing on LLVM now will actually make this option less limited if and when we are ready to support other styles. It would be mostly configuring/packaging what have already worked for LLVM.

> Also, one should probably be able to decide when to add/remove them by e.g. setting the number of lines in what's considered short blocks.

Agreed, but if clang-format can't do insertion well independent of removal and vice versa, we probably will never get there.

So far, this patch has successfully applied to clang/lib/Format, i.e., it builds successfully and passes FormatTests.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116316/new/

https://reviews.llvm.org/D116316



More information about the cfe-commits mailing list