]> granicus.if.org Git - clang/commit
[clang-format] Add a NamespaceEndCommentsFixer
authorKrasimir Georgiev <krasimir@google.com>
Mon, 27 Feb 2017 13:28:36 +0000 (13:28 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Mon, 27 Feb 2017 13:28:36 +0000 (13:28 +0000)
commit1741253403c8255faa3674bcaaf6663c9a1a1a2e
tree8813efb0313821472f71331c8e82b6c6e1e33c55
parent7cf8dd5ce168bed45b57e019149e33300c56f94b
[clang-format] Add a NamespaceEndCommentsFixer

Summary:
This patch adds a NamespaceEndCommentsFixer TokenAnalyzer for clang-format,
which fixes end namespace comments.
It currently supports inserting and updating existing wrong comments.

Example source:
```
namespace A {
int i;
}

namespace B {
int j;
} // namespace A
```

after formatting:
```
namespace A {
int i;
} // namespace A

namespace B {
int j;
} // namespace B
```

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: klimek, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296341 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Format/Format.h
lib/Format/CMakeLists.txt
lib/Format/Format.cpp
lib/Format/NamespaceEndCommentsFixer.cpp [new file with mode: 0644]
lib/Format/NamespaceEndCommentsFixer.h [new file with mode: 0644]
lib/Format/TokenAnnotator.h
lib/Format/UnwrappedLineParser.cpp
lib/Format/UnwrappedLineParser.h
unittests/Format/CMakeLists.txt
unittests/Format/NamespaceEndCommentsFixerTest.cpp [new file with mode: 0644]