]> granicus.if.org Git - clang/commit
[clang-format] Make NamespaceEndCommentFixer add at most one comment
authorKrasimir Georgiev <krasimir@google.com>
Mon, 6 Mar 2017 16:44:45 +0000 (16:44 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Mon, 6 Mar 2017 16:44:45 +0000 (16:44 +0000)
commit47d2e226a05a51f0b54b3630a038ba2f8cd4f6d5
tree2c4f8da6e6b4e22527b0126e74554c834bf5764a
parent736bfa413b9c390aeea1b518173443a96bff62b4
[clang-format] Make NamespaceEndCommentFixer add at most one comment

Summary:
Until now, NamespaceEndCommentFixer was adding missing comments for every run,
which results in multiple end comments for:
```
namespace {
  int i;
  int j;
}
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result before:

```
namespace {
  int i;
  int j;
}// namespace // namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result after:
```
namespace {
  int i;
  int j;
}// namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297028 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/NamespaceEndCommentsFixer.cpp
unittests/Format/NamespaceEndCommentsFixerTest.cpp