Line data Source code
1 : //===--- NamespaceCommentCheck.h - clang-tidy -------------------*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 :
10 : #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
11 : #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
12 :
13 : #include "../ClangTidy.h"
14 : #include "llvm/Support/Regex.h"
15 :
16 : namespace clang {
17 : namespace tidy {
18 : namespace readability {
19 :
20 : /// Checks that long namespaces have a closing comment.
21 : ///
22 : /// http://llvm.org/docs/CodingStandards.html#namespace-indentation
23 : ///
24 : /// https://google.github.io/styleguide/cppguide.html#Namespaces
25 0 : class NamespaceCommentCheck : public ClangTidyCheck {
26 : public:
27 : NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context);
28 : void registerMatchers(ast_matchers::MatchFinder *Finder) override;
29 : void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
30 :
31 : private:
32 : void storeOptions(ClangTidyOptions::OptionMap &Options) override;
33 :
34 : llvm::Regex NamespaceCommentPattern;
35 : const unsigned ShortNamespaceLines;
36 : const unsigned SpacesBeforeComments;
37 : llvm::SmallVector<SourceLocation, 4> Ends;
38 : };
39 :
40 : } // namespace readability
41 : } // namespace tidy
42 : } // namespace clang
43 :
44 : #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
|