summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/NamespaceEndCommentsFixer.h
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-04-19 13:02:15 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-04-19 13:02:15 +0000
commit621030523b0e57672979c495778ba8f13d86afa4 (patch)
tree5a6cb6c351904c1ac4b8a2f0c7959011d854ffef /clang/lib/Format/NamespaceEndCommentsFixer.h
parentd96ddccdb4e6c74e727d97cb811e400b15ab32f7 (diff)
downloadbcm5719-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.h10
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);
OpenPOWER on IntegriCloud