annotate clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.h @ 214:0cf2d4ade63d

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 13 Jul 2021 09:53:52 +0900
parents 0572611fdcc8
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===--- NamespaceCommentCheck.h - clang-tidy -------------------*- C++ -*-===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
anatofuz
parents:
diff changeset
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 #include "../ClangTidyCheck.h"
anatofuz
parents:
diff changeset
13 #include "llvm/Support/Regex.h"
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 namespace clang {
anatofuz
parents:
diff changeset
16 namespace tidy {
anatofuz
parents:
diff changeset
17 namespace readability {
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 /// Checks that long namespaces have a closing comment.
anatofuz
parents:
diff changeset
20 ///
anatofuz
parents:
diff changeset
21 /// http://llvm.org/docs/CodingStandards.html#namespace-indentation
anatofuz
parents:
diff changeset
22 ///
anatofuz
parents:
diff changeset
23 /// https://google.github.io/styleguide/cppguide.html#Namespaces
anatofuz
parents:
diff changeset
24 class NamespaceCommentCheck : public ClangTidyCheck {
anatofuz
parents:
diff changeset
25 public:
anatofuz
parents:
diff changeset
26 NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context);
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
27 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
28 return LangOpts.CPlusPlus;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
29 }
150
anatofuz
parents:
diff changeset
30 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
anatofuz
parents:
diff changeset
31 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 private:
anatofuz
parents:
diff changeset
34 void storeOptions(ClangTidyOptions::OptionMap &Options) override;
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 llvm::Regex NamespaceCommentPattern;
anatofuz
parents:
diff changeset
37 const unsigned ShortNamespaceLines;
anatofuz
parents:
diff changeset
38 const unsigned SpacesBeforeComments;
anatofuz
parents:
diff changeset
39 llvm::SmallVector<SourceLocation, 4> Ends;
anatofuz
parents:
diff changeset
40 };
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 } // namespace readability
anatofuz
parents:
diff changeset
43 } // namespace tidy
anatofuz
parents:
diff changeset
44 } // namespace clang
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H