[PATCH] D35794: [clang-format] Fix comment levels between '} else {' and PPDirective.

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 04:34:01 PDT 2017


krasimir created this revision.
Herald added a subscriber: klimek.

This fixes a regression exposed by r307795 and https://reviews.llvm.org/rL308725 in which the level of a
comment line between '} else {' and a preprocessor directive is incorrectly set
as the level of the '} else {' line. For example, this :

  int f(int i) {
    if (i) {
      ++i;
    } else {
      // comment
  #ifdef A
      --i;
  #endif
    }
  }

was formatted as:

  int f(int i) {
    if (i) {
      ++i;
    } else {
    // comment
  #ifdef A
      --i;
  #endif
    }
  }


https://reviews.llvm.org/D35794

Files:
  lib/Format/TokenAnnotator.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  unittests/Format/FormatTestComments.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35794.107882.patch
Type: text/x-patch
Size: 8737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170724/cd2884e5/attachment.bin>


More information about the cfe-commits mailing list