[PATCH] D19069: clang-format: Fixed various brace wrapping and block merging bugs

Maxime Beaulieu via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 12:02:26 PDT 2016


mxbOctasic created this revision.
mxbOctasic added a reviewer: djasper.
mxbOctasic added subscribers: cameron314, cfe-commits.
Herald added a subscriber: klimek.

Multiple brace wrapping flag combination were broken. 

First, IndentBraces + !AfterControlStatement caused the whole If-Else construct to be indented.

Currently, only function blocks can be merged into one line when the opening brace wrapped.
The short block merging logic checks the AfterFunction flag for all block types.
With AllowShortFunctions (All), !BraceWrapping.AfterFunction and BraceWrapping.AfterControlStatement I ended up with this: 
      if(true)
      {}
This happened with all other non-function blocks with the opening brace wrapped on its own line.


http://reviews.llvm.org/D19069

Files:
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19069.53600.patch
Type: text/x-patch
Size: 23135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160413/2eda097f/attachment-0001.bin>


More information about the cfe-commits mailing list