]> granicus.if.org Git - clang/commit
[clang-format] Fix comment levels between '} else {' and PPDirective.
authorKrasimir Georgiev <krasimir@google.com>
Mon, 24 Jul 2017 14:51:59 +0000 (14:51 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Mon, 24 Jul 2017 14:51:59 +0000 (14:51 +0000)
commit6fc7e24c557dbb0e2bd50646574e1de7d8d0dab5
tree8e1dab648eb4c149a192fc90c9970a555c68ef38
parent218d603c3469c99ffda646c75f3237f9020b147e
[clang-format] Fix comment levels between '} else {' and PPDirective.

Summary:
This fixes a regression exposed by r307795 and 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
  }
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D35794

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308882 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/TokenAnnotator.cpp
lib/Format/UnwrappedLineParser.cpp
lib/Format/UnwrappedLineParser.h
unittests/Format/FormatTestComments.cpp