diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2018-04-19 13:02:15 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2018-04-19 13:02:15 +0000 |
| commit | 621030523b0e57672979c495778ba8f13d86afa4 (patch) | |
| tree | 5a6cb6c351904c1ac4b8a2f0c7959011d854ffef /clang/lib/Format/NamespaceEndCommentsFixer.h | |
| parent | d96ddccdb4e6c74e727d97cb811e400b15ab32f7 (diff) | |
| download | bcm5719-llvm-621030523b0e57672979c495778ba8f13d86afa4.tar.gz bcm5719-llvm-621030523b0e57672979c495778ba8f13d86afa4.zip | |
[clang-format] Don't remove empty lines before namespace endings
Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D45373
llvm-svn: 330324
Diffstat (limited to 'clang/lib/Format/NamespaceEndCommentsFixer.h')
| -rw-r--r-- | clang/lib/Format/NamespaceEndCommentsFixer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.h b/clang/lib/Format/NamespaceEndCommentsFixer.h index 4779f0d27c9..adfe38943c8 100644 --- a/clang/lib/Format/NamespaceEndCommentsFixer.h +++ b/clang/lib/Format/NamespaceEndCommentsFixer.h @@ -21,6 +21,16 @@ namespace clang { namespace format { +// Finds the namespace token corresponding to a closing namespace `}`, if that +// is to be formatted. +// If \p Line contains the closing `}` of a namespace, is affected and is not in +// a preprocessor directive, the result will be the matching namespace token. +// Otherwise returns null. +// \p AnnotatedLines is the sequence of lines from which \p Line is a member of. +const FormatToken * +getNamespaceToken(const AnnotatedLine *Line, + const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines); + class NamespaceEndCommentsFixer : public TokenAnalyzer { public: NamespaceEndCommentsFixer(const Environment &Env, const FormatStyle &Style); |

