[PATCH] D95168: [clang-format] Add InsertBraces option

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 1 02:16:38 PDT 2021


MyDeveloperDay updated this revision to Diff 383744.
MyDeveloperDay added a reviewer: HazardyKnusperkeks.
MyDeveloperDay added a comment.

I'd like to carry the mantle for this, before making any further changes I'd like to address some of the review comments

1. Add documentation warning about a modifying change (as agreed by the RFC)
2. Add version introduced information
3. Fix issue with Macro continuation (don't add the \n before the } unless you see a \\ line comment, otherwise let clang-format deal with the \n depending on the BraceWrapping style
4. Add unit tests for Macro continuation and Comment handling
5. Allow InsertBraces in other languages

TODO:

- break out into its own file (Format.cpp is getting too big)
- Look further into possible Removal (I have an idea for how this might be possible, and super useful for LLVM where we don't like single if {} ), I'd like to round out on this before introducing the options rather than having to change them later

- Should we add the possibility of removal should we change the option name to "AutomaticBraces" (thoughts?)
- @tiagoma please add your name and email addreess to this review so when the time comes to land this I can attribute to you as "Author".


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

https://reviews.llvm.org/D95168

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95168.383744.patch
Type: text/x-patch
Size: 19100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211101/139d482b/attachment-0001.bin>


More information about the cfe-commits mailing list