[PATCH] D45726: Format closing braces when reformatting the line containing theopening brace.This required a couple of yaks to be shaved:1. MatchingOpeningBlockLineIndex was misused to also store the closing index; instead, use a second variable, as this...

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 17 09:10:16 PDT 2018


klimek created this revision.
klimek added a reviewer: krasimir.

...doesn't

  work correctly for "} else {".

2. We needed to change the API of AffectedRangeManager to not use iterators; we always passed in begin / end for the whole container before, so there was no mismatch in generality.
3. We need an extra check to discontinue formatting at the top level, as we now sometimes change the indent of the closing brace, but want to bail out immediately afterwards, for example: void f() { if (a) { } void g(); Previously: void f() { if (a) { } void g(); Now: void f() { if (a) { } void g();

Format closing braces.


Repository:
  rC Clang

https://reviews.llvm.org/D45726

Files:
  lib/Format/AffectedRangeManager.cpp
  lib/Format/AffectedRangeManager.h
  lib/Format/Format.cpp
  lib/Format/NamespaceEndCommentsFixer.cpp
  lib/Format/SortJavaScriptImports.cpp
  lib/Format/TokenAnnotator.h
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  lib/Format/UsingDeclarationsSorter.cpp
  unittests/Format/FormatTestSelective.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45726.142787.patch
Type: text/x-patch
Size: 13085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180417/7e116da3/attachment.bin>


More information about the cfe-commits mailing list