[PATCH] D68296: clang-format: Add ability to wrap braces after multi-line control statements

Mitchell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 07:53:22 PDT 2019


mitchell-stellar updated this revision to Diff 222835.
mitchell-stellar edited the summary of this revision.
mitchell-stellar added a comment.

Thanks for the review. I have added documentation updates.

I do not have a public style guide to reference. My company just switched to auto-clang-formatting all of our code, and this patch addresses one of our biggest pain points: readability. When the opening brace of a multi-line control statement is not wrapped, we simply cannot tell at first glance where the control statement ends and where the body begins due to our indentation settings.

I think the fact that you yourself see the benefit of this change speaks to its viability.

I cannot think of any other brace wrapping rules that need this level of control. Our code base consists of millions of lines of code, so I'm pretty sure we would have found another instance.

I would be willing to support this patch and further revisions if this gets into master, as our company will depend on this feature.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68296

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/FormatTestObjC.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68296.222835.patch
Type: text/x-patch
Size: 21297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191002/eda9dabf/attachment-0001.bin>


More information about the cfe-commits mailing list